Live data from Hacker News

Why is JSON so popular? Developers want out of the syntax business

stereolambda.wordpress.com

91–100 of 120 posts

Re: Why is JSON so popular? Developers want out of the syntax business

#91

There are so many cool things you can do with JSON. I just created a boolean logical statement builder on a web page by using free form open and close parenthesis, and and/or radio buttons. A little regex to change the parenthesis into square brackets, then an eval(), and I can walk the whole statement recursively.

eval() strikes me as a dangerous thing, security-wise.

It seems to me like it's only dangerous in the context of XSS or bad server-side validation. With Firebug I can run any arbitrary JS on any website I like, even change what's already there. But that just affects me, unless the site uses what I can modify on the server and doesn't validate it there.

Re: Why is JSON so popular? Developers want out of the syntax business

#92
post #69

Earlier quoted context omitted.

The problem lies in dilution: if people recognize a new meaning in an old phrase, it becomes more difficult to convey the old meaning. (Because you can't use that phrase any more.) There is also the case where you thought you conveyed the new meaning, while it hasn't caught on yet (meaning, you made a mistake). So, better stay safe and stick to the old meaning while we can.

The dilution has already happened, and this cause is pretty much lost. English is my second language. I've known the "new" meaning since I was a kid. I've to date maybe seen the "old" meaning used a handful of times other than in examples given by people trying to correct someone using the new meaning. Outside of academia I'd be surprised to see it at all. I suspect it would be confusing to more people than would rec…

OK for this particular cause. I was more about a general stance: trying to slow down the rate of change in languages. The slower the change, the less confusing the language.

Re: Why is JSON so popular? Developers want out of the syntax business

#94
post #4

As one of the earlier commenters pointed out, lisp welcomes you to the 1960s.

Not enough data types in CL or Scheme's reader (Clojure wins here) and no standard between the lisps. But, there was something Lisp did right that no other mainstream scripting language has - it separated the reader and the evaluator. You can eval Perl or Ruby or Python, but not securely read it. This goes for Javascript too - you can eval a JSON, but you'd be an idiot.

> Not enough data types in CL [reader]

Huh? CL's reader handles structs, hashes, and vectors in addition to strings, lists, atoms (with packages), lots of number formats (including Roman), and the ability to express AGs, not just trees (yes, cyclic too). Plus some other things that I forget. (Arrays?)

What else do you want to read?

No matter - CL's reader is programmable....

Re: Why is JSON so popular? Developers want out of the syntax business

#95
post #86
post #82

Earlier quoted context omitted.

Yeah, sure. S-expresssions are literals in Lisp, and can be "parsed" calling eval. But I think that misses the larger point made by the OP. JSON is really useful even in languages other than Javascript. JSON wins over XML because XML is too complex and thus ambiguous. But JSON wins over s-expressions too, because s-expressions are too simple. How do you represent John Smith as an s-expression? Sure, it can be done. B…

It's true that s-expressions don't give you a literal syntax for hashmaps or arrays, but note that some lisps (e.g. Clojure) do support these natively … and in a syntax that's better than JSON since you don't have to type all those annoying commas ;-)

> It's true that s-expressions don't give you a literal syntax for hashmaps or arrays, but note that some lisps (e.g. Clojure

CL's reader is especially rich, and it's programmable....

Re: Why is JSON so popular? Developers want out of the syntax business

#96
post #69

Earlier quoted context omitted.

The problem lies in dilution: if people recognize a new meaning in an old phrase, it becomes more difficult to convey the old meaning. (Because you can't use that phrase any more.) There is also the case where you thought you conveyed the new meaning, while it hasn't caught on yet (meaning, you made a mistake). So, better stay safe and stick to the old meaning while we can.

The dilution has already happened, and this cause is pretty much lost. English is my second language. I've known the "new" meaning since I was a kid. I've to date maybe seen the "old" meaning used a handful of times other than in examples given by people trying to correct someone using the new meaning. Outside of academia I'd be surprised to see it at all. I suspect it would be confusing to more people than would rec…

The dilution has already happened, and this cause is pretty much lost.

Don't give up too easily.

Outside of academia I'd be surprised to see it at all. That's because it's originally an academical term for a logical fallacy. This is like the abuse of 'eigenvalues' by all kinds of crackpots and we should never stop fighting that kind of language abuse. We can't keep inventing new terms, just because others have hijacked the previous one.

Re: Why is JSON so popular? Developers want out of the syntax business

#97
post #69

Earlier quoted context omitted.

The problem lies in dilution: if people recognize a new meaning in an old phrase, it becomes more difficult to convey the old meaning. (Because you can't use that phrase any more.) There is also the case where you thought you conveyed the new meaning, while it hasn't caught on yet (meaning, you made a mistake). So, better stay safe and stick to the old meaning while we can.

The dilution has already happened, and this cause is pretty much lost. English is my second language. I've known the "new" meaning since I was a kid. I've to date maybe seen the "old" meaning used a handful of times other than in examples given by people trying to correct someone using the new meaning. Outside of academia I'd be surprised to see it at all. I suspect it would be confusing to more people than would rec…

The dilution has already happened, and this cause is pretty much lost.

Don't give up too easily.

Outside of academia I'd be surprised to see it at all. That's because it's originally an academical term for a logical fallacy. This is like the abuse of 'eigenvalues' by all kinds of crackpots and we should never stop fighting that kind of language abuse. We can't keep inventing new terms, just because others have hijacked the previous one.

Re: Why is JSON so popular? Developers want out of the syntax business

#98
post #75
post #71

Earlier quoted context omitted.

XML brings a lot of other baggage to the party. Some of it can be useful. I particularly like XML namespaces, because when used properly there's hardly an equivalent in any other standardized serialization format I know. (And part of the problem is that you really need it standardized at the serialization format level for it to work; you can hack things into any other format but by definition you're not doing it in a…

>> This is equivalent to JSON needing to track {, [, ', and ", among other things. That's just parsing; both JSON and XML need to be parsed. That's not an advantage. JSON can simply count brackets. That makes for a very simple parser indeed. XML needs to cope with invalid nesting, end tag names not matching start tag names etc. End tag names are just wasted space. >> This is equivalent to the escape sequences in JSON…

[deleted]

Re: Why is JSON so popular? Developers want out of the syntax business

#99
post #75
post #71

Earlier quoted context omitted.

XML brings a lot of other baggage to the party. Some of it can be useful. I particularly like XML namespaces, because when used properly there's hardly an equivalent in any other standardized serialization format I know. (And part of the problem is that you really need it standardized at the serialization format level for it to work; you can hack things into any other format but by definition you're not doing it in a…

>> This is equivalent to JSON needing to track {, [, ', and ", among other things. That's just parsing; both JSON and XML need to be parsed. That's not an advantage. JSON can simply count brackets. That makes for a very simple parser indeed. XML needs to cope with invalid nesting, end tag names not matching start tag names etc. End tag names are just wasted space. >> This is equivalent to the escape sequences in JSON…

> XML needs to cope with invalid nesting, end tag names not matching start tag names etc.

I think you read a different spec ;) http://www.w3.org/TR/REC-xml/#sec-logical-struct :

    Well-formedness constraint: Element Type Match

    The Name in an element's end-tag MUST match the element type in the start-tag.
XML parser rejects the document as soon as this occurs. No different than with `{]` in JSON.

Changing " into " allows you to go to the next " without worrying about the contents before. The next " is the ending quote. Then you can resolve all the internals lazily... saving on processing time compared to JSON. For example "\"\\\"" will go through many branches and conditions. ""\"" is a simple jump over to the next " character.

Re: Why is JSON so popular? Developers want out of the syntax business

#100

Observing the industry over the last couple of decades, I'm left with the feeling that sometime in the last ten years or so we all went XML crazy. The popularity of JSON is just the pendulum starting to swing the other way. So count me in. I'll use JSON over XML for server-webclient data exchange whenever I can. It's just much easier.

The funny thing is, we all knew we were going XML crazy while it was happening. I can remember anti-XML bloat articles going way back. The thing with XML was, it DID solve some problems, it just tried too hard.

The good thing about XML was it was a standard interchange format that every language had at least a couple parsers for. That said, I'm not sure if it was worth the annoyance and irritation of using stuff like XML Schema, DTDs, SOAP, or XSLT.

Post reply on HN