Re: JSON / XML support in E

Kevin Reid <kpreid-M/[email protected]> Thu, 8 Sep 2011 09:33:31 -0400
Newsgroups gmane.comp.lang.e.general
Message-ID <[email protected]>
On Sep 8, 2011, at 8:21, Thomas Leonard wrote:
> On further investigation, it seems that newlines aren't allowed in JSON 
> strings anyway:
> 
> http://stackoverflow.com/questions/42068/how-do-i-handle-newlines-in-json
> 
> This patch turns newlines into "\n" sequences and doesn't quote "'" 
> (which JSON also doesn't allow):
> 
> http://gitorious.org/~tal-itinnov/repo-roscidus/it-innovation/commit/1b0a82891d305059c3732bc33b6702b41e944acf
> 
> I spotted these problems when trying to parse E's JSON output using 
> Python. The changes also fix <elib:serial.deJSONKit>.

Looks OK, but please audit other users of StringHelper to see if any need it the other way.

I would object to escaping newlines for the readability reduction, except that not doing so means that pretty-printing indentation changes the content, which is a bug.

-- 
Kevin Reid                                  <http://switchb.org/kpreid/>