Excuse me for the question just before the vote.
Does this include a way to output json in a streamed fashion?
E.g. from a Lucene search result?
If yes, this should be documented.
If not, is this hard to impossible? (is the String output really the only 
possible output of velocity? that sounds bad to me).

I guess that if this remains no, one will still see people output a part of 
their json in velocity text and a part using that tool which is not the best 
practice to my taste.

paul


Le 14 mars 2012 à 09:08, Marius Dumitru Florea a écrit :

> 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

Reply via email to