-
Notifications
You must be signed in to change notification settings - Fork 115
Picky JSON Scanner
From a mail exchange with Troex Nevelin:
Hello Troex!
On 31.01.10 22:33, Troex Nevelin wrote:
JSON also support’s comments, here is a little patch to support //-like
I think it does not.
This is a common misconception among JSON users, since various
frameworks and parsers allow extensions to the format, like comments or
unquoted keys ({ key: “value” }) – both are valid JavaScript, but
invalid JSON.
http://json.org and the RFC clearly state that:
http://www.ietf.org/rfc/rfc4627.txt?number=4627I thought about adding these typically used JSON extensions to the
scanner, but decided against it. I wanted the scanner to highlight
invalid JSON as errors.
Maybe it would be wiser to add a second, “Extended JSON” scanner (jsonx
or something) to support the format you use? I’d be happy to include it
in CodeRay, as long as the current behaviour for JSON is retained by
default. Also, you can use the JavaScript scanner for JSON.
Best Regards to Russia!
murphy
(Answer)
Thanks for the detailed response.
I think ‘jsonx’ is not needed as javascript can highlight JSON syntax
with comments.
You can look here where we use it http://dev.std42.ru/redmine/wiki/elfinder/Client-Server_Protocol_RU#open