[VOTE] Introducing a new velocity tool for JSON manipulation

8 messages Options
Embed this post
Permalink
Jerome Velociter-2

[VOTE] Introducing a new velocity tool for JSON manipulation

Reply Threaded More More options
Print post
Permalink
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/JsonGroovyBuilder.html)
and the JSONSlurper
(http://json-lib.sourceforge.net/apidocs/jdk15/net/sf/json/groovy/JsonSlurper.html)
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
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Jerome Velociter-2

Re: [VOTE] Introducing a new velocity tool for JSON manipulation

Reply Threaded More More options
Print post
Permalink
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/JsonGroovyBuilder.html)
> and the JSONSlurper
> (http://json-lib.sourceforge.net/apidocs/jdk15/net/sf/json/groovy/JsonSlurper.html)
> 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
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs

_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
tmortagne

Re: [VOTE] Introducing a new velocity tool for JSON manipulation

Reply Threaded More More options
Print post
Permalink
In reply to this post by Jerome Velociter-2
+1

On Sat, Oct 10, 2009 at 17:57, Jerome Velociter <[hidden email]> 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/JsonGroovyBuilder.html)
> and the JSONSlurper
> (http://json-lib.sourceforge.net/apidocs/jdk15/net/sf/json/groovy/JsonSlurper.html)
> 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
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs
>



--
Thomas Mortagne
_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Marius Dumitru Florea

Re: [VOTE] Introducing a new velocity tool for JSON manipulation

Reply Threaded More More options
Print post
Permalink
In reply to this post by Jerome Velociter-2
+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/JsonGroovyBuilder.html)
> and the JSONSlurper
> (http://json-lib.sourceforge.net/apidocs/jdk15/net/sf/json/groovy/JsonSlurper.html)
> 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
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Asiri Rathnayake

Re: [VOTE] Introducing a new velocity tool for JSON manipulation

Reply Threaded More More options
Print post
Permalink
In reply to this post by Jerome Velociter-2
+1

- Asiri
_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Jerome Velociter-2

Re: [VOTE] Introducing a new velocity tool for JSON manipulation [SUMMARY]

Reply Threaded More More options
Print post
Permalink
In reply to this post by Jerome Velociter-2
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/JsonGroovyBuilder.html)
> and the JSONSlurper
> (http://json-lib.sourceforge.net/apidocs/jdk15/net/sf/json/groovy/JsonSlurper.html)
> 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
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs
>    

_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
vmassol

Re: [VOTE] Introducing a new velocity tool for JSON manipulation [SUMMARY]

Reply Threaded More More options
Print post
Permalink
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/JsonGroovyBuilder.html 
>> )
>> and the JSONSlurper
>> (http://json-lib.sourceforge.net/apidocs/jdk15/net/sf/json/groovy/JsonSlurper.html 
>> )
>> 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
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Jerome Velociter-2

Re: [VOTE] Introducing a new velocity tool for JSON manipulation [SUMMARY]

Reply Threaded More More options
Print post
Permalink
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/JsonGroovyBuilder.html
>>> )
>>> and the JSONSlurper
>>> (http://json-lib.sourceforge.net/apidocs/jdk15/net/sf/json/groovy/JsonSlurper.html
>>> )
>>> 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
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs

_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs