23 Feb 2011 - Digital Strategy // By Productive Edge Team

JSON gods have been appeased!

ActiveJDBC gets built in JSON generation, here is a simple example:

Person p = (Person)Person.findById(1);
String xml = p.toJson(true);

will generate this:

"updated_at":"2011-02-23 22:18:11.0",
"created_at":"2011-02-23 22:18:11.0"

The functionality is quite similar to that of the toXml() method, and more options are available, including specifying what attributes you want, pretty/ugly formats and inclusion of children. for more information, look here: GenerationOfJson.


JSON gods have been appeased!