News for hackers. Stuff that matters.
Re:Son – A minimal subset of JSON for machine-to-machine com... by kornish on Tuesday March 14, 2017 @04:27PM (#13871169)
> Son is a starting point for building such a pretty printer.

I don't understand: such pretty printers already exist (e.g. jq, which does a whole lot more [0]). If you're transmitting JSON and want to diff two documents, just pipe them into jq or another pretty-printer with key ordering, then use one of many existing line-by-line diff tools.

[0]: github.com/stedolan/jq

Re:Son – A minimal subset of JSON for machine-to-machine com... by hyperpallium on Tuesday March 14, 2017 @05:40PM (#13871707)

  $ echo "1." | jq .
  1
jq is great, but doesn't preserve float/int distinction. There may be other canonicalization details that pretty printers don't address.

It might be simpler to change jq and/or other pretty printers (though might be implementation or design reasons not to).

But the other advantage of a new project like SON is positioning not engineering, in our heads, not in the code: tool for the job. If so, the page should spend more time on what that job is (for when people search for that job).

And, as the jq example shows, tools not designed for this job mightn't do it exactly right.

EDIT I was reading offline, so didn't see the sibling reply.

Re:Son – A minimal subset of JSON for machine-to-machine com... by seagreen on Tuesday March 14, 2017 @07:48PM (#13872627)
I love that we both started our comments with "jq is great". I hadn't seen yours either=)
Re:Son – A minimal subset of JSON for machine-to-machine com... by seagreen on Tuesday March 14, 2017 @05:01PM (#13871438)
jq is great. You can actually see how it's used to test the reference implementation of Son here (https://github.com/seagreen/Son/blob/master/implementation/t...) using `jq --compact-output --sort-keys .`

Unfortunately, jq doesn't provide flags to control scientific/non-scientific notation or which characters are escaped, meaning if you want very tight control over the JSON generated it's not a full option.

(Consider that the motivating example in the Son README isn't all you might want to use Son for. For instance some people need consistent hashing of serialized JSON documents).

Re:Son – A minimal subset of JSON for machine-to-machine com... by kornish on Wednesday March 15, 2017 @12:10AM (#13873741)
Ah, understood - thanks for clarifying!

Side note: I respect your positivity and steadfastness in the face of a skeptical HN response.

Re:Son – A minimal subset of JSON for machine-to-machine com... by seagreen on Wednesday March 15, 2017 @01:54AM (#13874096)
Sure thing. And thanks, that made me smile.