On 03/09/2012 08:54 AM, Marius Dumitru Florea wrote:
Hi devs,
Some time ago Jerome Velociter raised a vote [1] for adding a JSON Velocity Tool. The vote passed but the tool wasn't committed. I'd like to do it know (for 4.0M1) with two changes:
1. Use Jackson [2] instead of json-lib [3] because it has a more recent release 2. Add only the toJSON method for now because we can use $escapetool.javascript to accomplish the same result as toValueString
Not true, $escapetool.javascript always escapes both " and ' in a string, and this isn't valid JSON, according to jsonlint.com (and the JSON specification on json.org): {"key" : "value with escaped \" and esaped \' is wrong"} So far I used $escapetool.javascript($var).replace('\''', '''') to fix this.
Reply quickly if you are against it.
Thanks, Marius
[1] http://www.mail-archive.com/[email protected]/msg11395.html [2] http://jackson.codehaus.org/ [3] http://json-lib.sourceforge.net/
-- Sergiu Dumitriu http://purl.org/net/sergiu/