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:
{
"type":"activejdbc.test_models.Person",
"id":"1",
"updated_at":"2011-02-23 22:18:11.0",
"graduation_date":"1954-12-01",
"name":"John",
"dob":"1934-12-01",
"last_name":"Smith",
"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.
enjoy,
igor