[xwiki-devs] [VOTE] Introducing a new velocity tool for JSON manipulation
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/JsonGroovyB...) and the JSONSlurper (http://json-lib.sourceforge.net/apidocs/jdk15/net/sf/json/groovy/JsonSlurper...) 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.
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)
public String toValue(String value) is probably better in fact Jerome.
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/JsonGroovyB...) and the JSONSlurper (http://json-lib.sourceforge.net/apidocs/jdk15/net/sf/json/groovy/JsonSlurper...) 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. _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
+1 On Sat, Oct 10, 2009 at 17:57, Jerome Velociter <[email protected]> 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/JsonGroovyB...) and the JSONSlurper (http://json-lib.sourceforge.net/apidocs/jdk15/net/sf/json/groovy/JsonSlurper...) 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. _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
+1 Thanks, Marius 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/JsonGroovyB...) and the JSONSlurper (http://json-lib.sourceforge.net/apidocs/jdk15/net/sf/json/groovy/JsonSlurper...) 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. _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
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/JsonGroovyB...) and the JSONSlurper (http://json-lib.sourceforge.net/apidocs/jdk15/net/sf/json/groovy/JsonSlurper...) 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. _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
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/JsonGroovyB... ) and the JSONSlurper (http://json-lib.sourceforge.net/apidocs/jdk15/net/sf/json/groovy/JsonSlurper... ) 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.
On 11/2/09 10:53 AM, Vincent Massol wrote:
Hi Jerome,
Was this committed (I don't remember seeing it)? If not, where do you intend to commit it?
I have not committed anything so far. Following our discussion on jabber, I'll come up with a proposal for components to expose scripting services. Jerome.
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/JsonGroovyB... ) and the JSONSlurper (http://json-lib.sourceforge.net/apidocs/jdk15/net/sf/json/groovy/JsonSlurper... ) 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.
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (5)
-
Asiri Rathnayake -
Jerome Velociter -
Marius Dumitru Florea -
Thomas Mortagne -
Vincent Massol