6 ms·
I feel as soon as every database supports JSON the world will move to a different data format. Like I feel a bit sad for Scala having native XML.
by ape4 11y ago
I feel as soon as every database supports JSON the world will move to a different data format. Like I feel a bit sad for Scala having native XML.
- applecore 11y agoJavaScript has pretty good, native JSON support.
- sopooneo 11y agoWhat do we mean by that? Hasn't JavaScript always had native JSON support since whenever "eval()" was included?
- sinatra 11y agoI think applecore's comment was tongue-in-cheek considering JSON is JavaScript Object Notation and was originally derived from JavaScript.
- TazeTSchnitzel 11y agoeval() isn't quite the same. It's unsafe for starters: it permits any JS code, not just JSON. But JavaScript has the JSON object offering a high-quality, high-performance parser (JSON.parse) and serialiser (JSON.stringify).
- ape4 11y agoIts funny how JSON emerged as subset of JavaScript - easy to parse with eval(). But now if you do that its terrible code. So the subset aspect is totally irrelevant now.
- heydenberk 11y agoThe subset aspect is indeed still relevant. JSONP callbacks[0] make use of JSON's just-JavaScript nature. [0] https://en.wikipedia.org/wiki/JSONP https://en.wikipedia.org/wiki/JSONP
- TazeTSchnitzel 11y agoIn old browsers, yes. The much more secure CORS is now an option, however.
- mycelium 11y agoXML can't piggyback on the success of anything. It's just a human readable data format, and a cumbersome one at that. It make sense in certain use cases and not in others, but it has to fight it out with other data formats on its own weak merits. JSON is the object literal format for Javascript, likely the single most widely deployed and used programming language in the world. Until paradigm shifts obsolete the web browser, JSON will be ubiquitous.
- taeric 11y agoThis is.... an interesting perspective. Why couldn't xml "piggyback" off of the success of html, for example?
- shaneofalltrad 11y agoGood point, but xml is "cumbersome" or hard and json is not (in the eyes of many). xml was widely hated before json become widely accepted while json is not as widely hated.
- taeric 11y agoI definitely agree that that is the perception. So, apologies to all if my tone earlier implied any condescension. What intrigues me is why is it so. There is a great article in one of the Programming Pearls books (so, published earlier), that goes over how providing provenance in a data format is highly useful. Yet, by and large, you can not do this in JSON, because comments are disallowed.
- comex 11y agoI think a relevant paradigm shift partially exists in the form of static typing. Sure, you can still use JSON in a statically typed language, and many do, but it's more cumbersome than in a dynamic one, while the space efficiency and built-in validation of things like protobuf start to look more appealing. Even on the web, statically typed compile-to-JS languages are rising in popularity, though nobody is using protobuf there... We'll see. I definitely expect JSON to remain popular for many years at the least.
- justthistime_ 11y ago> Like I feel a bit sad for Scala having native XML. In what sense?
- kodablah 11y agoIIRC, Scala's parser/compiler had to have a few little things added to support it even though Scala's syntax mostly supports it without messing with the internals. I could be wrong here, I am a bit fuzzy on the details. Also they sure put in a lot of effort in custom extractors and lots of other features to make it feel like the language supported it natively. But now Scala's XML support is a separate library that is not included with the distribution.
- kbaker 11y agoNah, JSON is just another serialization format, with its own tradeoffs when used inside the database. Go ahead and read this article from MS SQL server from 2004, about introducing similar features for XML (binary storage, functional indexes) inside the database. https://msdn.microsoft.com/en-us/magazine/cc188738.aspx https://msdn.microsoft.com/en-us/magazine/cc188738.aspx In 10 years, the relational model didn't budge. There are loads of good reasons for why you'd want to decompose data into native DB types, with a strongly-typed schema.
- rbonvall 11y agoDuring the last month, two (barely related) Scala programs that I needed to implement in my job were an SVG image generator and an XSD schema creator. I'm thankful that Scala has XML literals, even though when I learned that it did I found it laughable.