[erlang-questions] No JSON/MAPS interoperability in 17.0?

Anthony Ramine n.oxyde@REDACTED
Sun Mar 9 20:25:31 CET 2014


Replied inline.
-- 
Anthony Ramine

Le 9 mars 2014 à 20:06, Carsten Bormann <cabo@REDACTED> a écrit :

> On 09 Mar 2014, at 17:05, Anthony Ramine <n.oxyde@REDACTED> wrote:
> 
>> What about the utter lack of proper specifications around JSON?
> 
> JSON is fully specified in RFC 7159.

I said around. There is absolutely no tooling around JSON which is properly specified and widely used, that was to reply to the namedropping of ASN.1 and XML.

>> The fact that you always have to think about where the JSON will be injected?
> 
> Why would you need to think about that?  JSON is usually transported using a data-transparent transfer mechanism such as HTTP.
> If it isn’t, you may need some help from an application-specific library, but that is irrelevant for the dominant usage of JSON.

Dominant? Do you have statistics for this? My own experience is that we inject JSON in webpages a lot. Stack Overflow seems to agree.

>> What about a JSON-encoded string containing "</script>", should that be avoided by Erlang’s builtin parser? What about "]]>"? What about the two characters that are accepted in JSON but not in JavaScript?
> 
> The news here may be that in the present decade JSON rarely is transported inside HTML documents or converted into JavaScript for parsing.  So all this is entirely irrelevant.

See above. PHP has some options to counter these problems, Rails has escape_html_entities_in_json.

>> Just because other languages include such a thing doesn’t mean Erlang should too.
> 
> Of course that would be a weak reason.  But it's a straw man.
> The reason for supporting JSON at the standard library level is that JSON is the most widely used format to interchange data.

Most widely used? In the web probably. In other fields, I wouldn’t bet on this.

> Not having it is fine for a language that doesn’t care about interchanging data.

Given that there is a myriad of third-party JSON libraries, what’s the problem?

And a standard library which sets in stone such a supposedly-important feature the moment a convenient datatype is available isn’t worth anything, in my opinion.




More information about the erlang-questions mailing list