Hi Jerome,
Was this committed (I don't remember seeing it)? If not, where do you
intend to commit it?
Thanks
-Vincent
On Oct 14, 2009, at 5:41 PM, Jerome Velociter wrote:
4 +1
no 0
no -1
commiting in both branch 2.0 and trunk
Thanks,
Jerome.
On 10/10/09 6:57 PM, Jerome Velociter wrote:
> Hi all,
>
> I'd like to commit a new velocity tool to help producing JSON from
> velocity. It's mainly a wrapper around the json-lib library
> (
http://json-lib.sourceforge.net/).
>
> For a first version, I propose the 2 following APIs :
>
> public JSON toJSON(Object object)
> public String toValueString(String value)
>
> The first one should become a privileged way of producing JSON from
> velocity. It allows to easily write a JSON-valid String from java
> beans
> and/or maps. See
http://json-lib.sourceforge.net/usage.html#objects
> for
> more information of what it makes possible. Note that JSON#toString
> actually writes down the valid JSON, so in velocity we just have to
> do :
> $jsontool.toJSON($object)
>
> The second API is a helper to produce a JSON-valid value String
> from a
> java String (it escapes properly quotes).
>
> I've pasted the proposed implementation at
>
http://incubator.myxwiki.org/xwiki/bin/view/Main/VelocityJsonToolProposal
>
> As a bonus, this will make the JSON groovy builder
>
(
http://json-lib.sourceforge.net/apidocs/jdk15/net/sf/json/groovy/JsonGroovy…
> )
> and the JSONSlurper
> (
http://json-lib.sourceforge.net/apidocs/jdk15/net/sf/json/groovy/JsonSlurpe…
> )
> available for groovy scripting.
>
> If you agree I would like to commit it in branch 2.0 as well, as
> this is
> the clean way of fixing some issues with the livetable. (For
> example :
>
http://jira.xwiki.org/jira/browse/XWIKI-4282).
>
> My +1 for the tool,
>
> Thanks,
> Jerome.