Flexjson Change Log
Version 1.5
Sept 26, 2007
- Enhancements
-
Added support for wildcarding fields (exclude *.class). This allows you to include and exclude fields
through wildcards. Wildcarding is not used to serialize deeper in the graph. The only way to
serialize deeply is by explicitly naming a path like( foo.bar.baz ), or using deeplySerialize().
Wildcards simply act off the portion of the output specified in the other fields.
-
Includes and excludes are processed in the order they were added to the serializer. Includes and
excludes were previously processed by processing all includes first then processing the excludes.
That ment and include would override an exclude always. This has changed since wildcarding can catch
more fields that you expect. Say you did a wildcard include, and there was one field you wanted to
exclude. In the previous algorithm you couldn't do that, but now you can place the exclude before
the include and it will filter out just that field. All other fields would pass through and get
matched by the wildcard include. This is a very important change for existing
users. Analyze your includes/excludes for these changes! If you need the previous behavior
simply do your includes before your excludes (i.e. new JSONSerializer().include(...).exclude(...).serialize( myobj ) )
-
Added support for transformations. Transformations allow you provide additional data substituion
on specific fields. This comes in handy for doing things like HTML encoding values like
<, >, or &, converting markdown text into HTML text, etc. This allows you to execute
these types of manipulations on your server instead of in the browser.
-
Added prettyPrint() method so that output can be pretty printed for development.
- Bug Fixes
-
Strings containing '/' characters were being escaped unnecessarily. Removed the escaping of '/' in
strings. Thanks to Mendy Glazer for pointing this one out.
-
Removed unnecessary whitespace from the output from serialize() saving about 5% of the size.
-
When cycles were encountered in the object graph Flexjson could output bad json particularly with
collections. Usually this ment an extra comma was added when it shouldn't be. Now for maps,
arrays, properties of objects, and other collections it will first check to see if any output was
created before putting the comma in the output. Thanks to Mendy Glazer for this one.
-
Declared fields in base classes weren't being serialized. Now Flexjson will traverse up the
heirarchy and serialize any public non-static, non-transient field it encounters. Thanks to
Miroslav Pokorny for finding this one.
-
Documentation was incorrect about serializing many-to-one and one-to-one relationships. They are
automatically serialized by default. If you don't want many-to-one or one-to-one relationships
serialized use the exclude() method to omit them. Thanks to Steve Schmitt for pointing this out.
-
Hibernate proxies could cause trouble if you tried to serialize them. Flexjson tries to inspect
the interfaces of each object to figure out it's fields. Hibernate Proxies are not inspectable
in this way. Flexjson will recognize Hiberate Proxies and dig into them to find the actual proxied
object. BEWARE: A Hibernate Proxy usually indicates that you haven't loaded this object through
lazy initialization. That means when Flexjson tries to dig the real object out of the proxy it can
trip Hibernate to go back to the DB and load that object. This is very
inefficient! Analyze how you are loading your objects from the DB, and make sure you are eagerly
loading all of your objects you plan to serialize. Remember if flexjson is walking over a
relationship it shouldn't, use an exclude() to turn it off! Thanks to Max Grigoriev.
Version 1.2
May 22, 2007
- Enhancements
-
Added deepSerialize method to serialize a Java object recursively. Includes, excludes, and
annotations are honored. However, using includes really only matters if you are overiding
an annotation that is excluding a field by default. Cycles in the graph are ignored.
- Bug Fixes
-
Made Flexjson output conform to JSON standard. The serialization of dates is not standardized by
the JSON spec. However, you cannot use the new keyword in the JSON output according to the spec.
So the JSON Flexjson was emitting in the previous was not JSON compliant because it would write out
new Date( ... ). It has been changed to send the time as the number of milliseconds
since midnight, January 1, 1970 UTC.
-
Cycles in the graph produced a StackOverflowException. Objects that had circular references
would produce StackOverflowException. While you could workaround this issue using excludes or
annotations the code was now fixed to prevent the stack overflows by default and not serialize
cycles. Any cycle in the graph will be ignored.
Version 1.1
April 21, 2007
-
Enhancements
- Added support for enumerated types
Version 1.0
April 18, 2007