Friday, June 1, 2012

Field Exclusion with GSON

Easiest way to do it is to actually use annotations to mark fields to include.

To use this, just create Gson object this way:
new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create()

And then annotate every field you want to expose with the @Expose annotation.

No comments:

Post a Comment