Groovy JsonSlurper Issue involving commas in JSON -
i have json coming controller, call params.formdata, looks this:
'{"year":"2014","resource":["smith, john","foo, bar"]}' my code parse it:
.... def slurper = new jsonslurper() def data = slurper.parsetext(params.formdata) ... data looks like:
[resource:["smith", "john", "foo", "bar"], year:"2014"] notice there 2 json entries, , parser made array of 4 entries. want this:
[resource:["smith, john", "foo, bar"], year:"2014"] does know how handle situation?
i don't think does.
assert data.resource.size() == 2 should prove me right ;-)
my guess output of printing data:
[resource:[smith, john, foo, bar], year:2014] confused things. looks 4, it's 2
Comments
Post a Comment