News for hackers. Stuff that matters.
Re:Unix is not an acceptable Unix by espadrine on Sunday June 07, 2015 @08:40AM (#9674409)
I don't understand your point, since JSON is a textual format.

Sure, the fact that Unix chose text meant they created a lot of different formats, some non-standard, but I don't see this being an issue, except for configuration purposes.

Re:Unix is not an acceptable Unix by nailer on Sunday June 07, 2015 @08:47AM (#9674432)
Do you deal with the serialized JSON text directly, or run JSON.parse() and JSON.stringify() to turn your JSON into objects?

Do you ever use regular expressions to parse unstructured text when using a Unix shell? Do you think 'grep' and thinking of a regex is more or less efficient that using 'where'?

Re:Unix is not an acceptable Unix by camperman on Sunday June 07, 2015 @10:34AM (#9674753)
"or run JSON.parse() and JSON.stringify() to turn your JSON into objects?"

By that time, the communication has already happened.

Re:Unix is not an acceptable Unix by throwawaykf05 on Sunday June 07, 2015 @01:59PM (#9675670)
Exactly. His point is that whatever operations you perform from that point on is on the object and not the string that was used to represent the object as it was being communicated. The string is just an intermediate representation. It's the object that's relevant to your business logic.
Re:Unix is not an acceptable Unix by nailer on Sunday June 07, 2015 @01:55PM (#9675647)
Well the only point of serialising was communication, so I'd argue unwrapping a presentation layer format is included as part of communication.
Re:Unix is not an acceptable Unix by camperman on Monday June 08, 2015 @10:05AM (#9679100)
Fair enough. I was coming at this from my current experience where a couple of different programs I have grab JSON from a server: the Python one puts it into an object, the bash script doesn't because I couldn't be bothered :)
Re:Unix is not an acceptable Unix by throwawaykf05 on Sunday June 07, 2015 @01:51PM (#9675623)
JSON is not a textual format. What it is, is right there in the name: It's an Object Notation. Now, JSON objects are most frequently serialized to text, but they are still objects. The format is an orthogonal matter.
Re:Unix is not an acceptable Unix by espadrine on Monday June 08, 2015 @06:30AM (#9678152)
Let me cite you json.org:

> JSON is a text format

json.org is owned by Douglas Crockford, who should know what JSON is, since he was the first to specify that format.

Re:Unix is not an acceptable Unix by nailer on Monday June 08, 2015 @09:52AM (#9679003)
Agreed, but nobody uses it without parsing it. You're not grepping JSON, you're JSON.parse() ing it.
Re:Unix is not an acceptable Unix by espadrine on Tuesday June 09, 2015 @02:32AM (#9684365)
Why does it matter whether the exchange format is a regular or a context-free language? It is a textual representation of binary data either way.

Sure, it is harder to pattern-match context-free, and we have a convenient syntax for textual regular languages, but we create tools such as jq so that we can pipe JSON and extract data.

Re:Unix is not an acceptable Unix by icebraining on Monday June 08, 2015 @04:44AM (#9677888)
The "notation" part is the serialization. JSON is a "system of written symbols used to represent" objects.