pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gkbr...@mac.com>
Subject Re: recommendation requested: json translation into objects
Date Fri, 02 Jul 2010 13:40:04 GMT
I should mention that, if it is not a bean, we generally provide a constructor that takes a
JSON type such as Map that you can use to instantiate the object. All of Pivot's "struct"
classes, including Dimensions, Point, etc., work this way so you can use them as a reference.

On Jul 2, 2010, at 9:35 AM, Greg Brown wrote:

>> What recommendation do people have for converting json syntax to an object? Should
I grab a library? If so, any suggestions on which one?
> If it is a bean, you can use JSONSerializer. See org.apache.pivot.tests.JSONBeanTest
for an example.
>> Ideally, I could register my converter and it gets called automatically when I indicate
the need for a conversion to a certain type.
> Generally, we handle this by providing a string setter that performs the conversion and
calls the typed setter.

View raw message