Hi.

Can't you add a parser function too ?

Right now, we have to use groovy for JSON parsing. It would be better to
have it in velocity directly, don't you think ?

Thanks,

Guillaume

2012/3/14 Andreas Jonsson <[email protected]>

> +1
>
> 2012-03-14 09:08, Marius Dumitru Florea skrev:
> > Hi devs,
> >
> > Following the discussion on
> > http://lists.xwiki.org/pipermail/devs/2012-March/049889.html I'd like
> > to add a JSON Velocity tool that has (for now) just one method:
> >
> > /**
> >  * Serialize a Java object to the JSON format.
> >  * <p>
> >  * Examples:
> >  * <ul>
> >  * <li>numbers and boolean values: 23, 13.5, true, false</li>
> >  * <li>strings: "one\"two'three" (quotes included)</li>
> >  * <li>arrays and collections: [1, 2, 3]</li>
> >  * <li>maps: {"number": 23, "boolean": false, "string": "value"}</li>
> >  * <li>beans: {"enabled": true, "name": "XWiki"} for a bean that has
> > #isEnabled() and #getName() getters</li>
> >  * </ul>
> >  *
> >  * @param object the object to be serialized to the JSON format
> >  * @return the JSON-verified string representation of the given object
> >  */
> > public String serialize(Object object)
> >
> > This method is able to do what both of the initially proposed methods
> > were able and it doesn't expose the JSON library used (so that we can
> > change it later if we want). I'll use json-lib for the initial
> > implementation and we can move to Jackson or other JSON library later.
> >
> > WDYT? I'd like to commit this ASAP.
> >
> > Thanks,
> > Marius
> > _______________________________________________
> > devs mailing list
> > [email protected]
> > http://lists.xwiki.org/mailman/listinfo/devs
> > .
> >
>
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to