Jason Stonebraker committed 6d93c97

Edited online

  • Participants
  • Parent commits 5da5cc1

Comments (0)

Files changed (1)

 The JSON Exclusion Marshaller is a Grails plugin that allows you to easily exclude class properties from the JSON converter's output. It does this by injecting a convenience method, excludesFor*(...), into Grails' JSON converter class.
+## Installation
+As a Dependency: 
+```compile ":json-exclusion-marshaller:0.2"```
+Via command line:
+```grails install-plugin json-exclusion-marshaller```
 ## Method Signature
 **Class:** [grails.converters.JSON](
 Basically the `excludeFor*()` method creates a Named Configuration with a name of
 'excludeForWhateverYouDecideToNameIt'. The Named Configuration then registers a custom ObjectMarshaller for the TestStudent domain class. The custom object marshaller is built into the `excludesFor*` sythesized method. It removes the properties we provided to it in the list. The JSON converter then outputs the desired JSON formatted string.
-## Installation
-As a Dependency: 
-```compile ":json-exclusion-marshaller:0.2"```
-Via command line:
-```grails install-plugin json-exclusion-marshaller```
+### Configure Global Exclusions
+You can specify a list of properties that should always be excluded by the JSON converter by adding a line like this to Config:
+`jsonExclusionMarshaller.globalExclusions = "attached, errors, properties, version, class, id"`
 ## What problem does the plugin solve?
 The grails.converter.JSON class is powerful. That power comes at the cost of some complexity though. This plugin utilizes Groovy's meta-programming features to simplify the common task of excluding arbitrary properties from the JSON payload at run-time. The most common use for this plugin will be to simply ensure that the 'id' and 'class' properties added by GORM are not included in the JSON string. Basically, it allows you to tackle this common task using expressive, domain specific language, quickly and simply. It also makes it simple to determine at run-time which properties to exclude.
 [Rendering JSON in Grails: Part 3 Customise your JSON with Object Marshallers](
+### Improvements in 0.3
+* Made the plugin useful for all pogos, not just Grails Domain Classes.
+* Added config element for global exclusions
+* Removed test code. Tests are now done externally.
 ### Improvements to be made
-* Make useful for all pogos, not just Grails Domain Classes.
 * Infer the class type of the target object rather than requiring it to be passed in. This is a challenge since the paradigm is based on static methods.
 * Stacking named marshallers to apply multiple marshallers to a single converter instance
 * Instance level ObjectMarshalling