Several comments mention the "Software shall be used for Good, not Evil" licensing issue in the JSON code from json.org. The original json.js file from json.org had this copyright and license: Copyright (c) 2005 JSON.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, includi…
That's great news. It has been a major inconvenience to remember to use XML in all of my evil applications.
ECMA-404: The JSON Data Interchange Format [pdf]
151–160 of 199 posts
Re: ECMA-404: The JSON Data Interchange Format [pdf]
#152Is it too late for edn? https://github.com/edn-format/edn
Symbols that aren't "strings" are kinda neat too, and you get downright attached to arbitrary key-value mappings once you have them.
Re: ECMA-404: The JSON Data Interchange Format [pdf]
#153Earlier quoted context omitted.
That sounds smart on first pass, but doesn't really help. If people were going to use /* @annotations / and instead put them in keys, either way, the other side gets a document that isn't the one intended*. So regardless if it parses or not, it doesn't really help.
At least you can inspect the document you got with normal tools. Not so if you include comments. And this may even encourage people into separating the data payload from the metadata, who knows?
Besides, JSON has already become a common format for config files. Config files that don't allow comments are truly a step backward.
Re: ECMA-404: The JSON Data Interchange Format [pdf]
#154"So for example, a string containing only the G clef character (U+1D11E) may be represented as "\uD834\uDD1E"" eww, UTF-16 surrogate pairs. Die, die, die, you scourge. (Yes, I've been working with the win32 api lately, which was designed for UCS2/UTF-16). when has 16 bit anything been a good idea, really. TCP port ranges, looking at you too.
Char can be anything not " or \. You don't have to escape unicode. If you want to just use Unicode and encode as UTF-8 then go nuts. This is valid JSON: { "äöü": "大家好", "clef": "𝄞" }
Python has an upper case \UXXXXXXXX literal that seems a lot cleaner.
Re: ECMA-404: The JSON Data Interchange Format [pdf]
#155"So for example, a string containing only the G clef character (U+1D11E) may be represented as "\uD834\uDD1E"" eww, UTF-16 surrogate pairs. Die, die, die, you scourge. (Yes, I've been working with the win32 api lately, which was designed for UCS2/UTF-16). when has 16 bit anything been a good idea, really. TCP port ranges, looking at you too.
Char can be anything not " or \. You don't have to escape unicode. If you want to just use Unicode and encode as UTF-8 then go nuts. This is valid JSON: { "äöü": "大家好", "clef": "𝄞" }
Re: ECMA-404: The JSON Data Interchange Format [pdf]
#156Earlier quoted context omitted.
I do use a real parser, but it is not possible for JSON-P.
Don't use JSONP.
Re: ECMA-404: The JSON Data Interchange Format [pdf]
#157Earlier quoted context omitted.
Yes, that solution OBVIOUSLY removes the need to spend an extra minute adding comments to the spec. Also, I hope, trailing commas and binary types.
Shoving binary into JSON is rather silly--base 64 encode it, or consider using a binary format better suited to your need. As for adding comments to the spec--again, the idea is to prevent shadow information showing up that isn't obvious to a conformant parser. If you give people the ability to smuggle data in comments, that's exactly what they'll do. At least this way people know that what they're doing isn't "to sp…
Re: ECMA-404: The JSON Data Interchange Format [pdf]
#158Re: ECMA-404: The JSON Data Interchange Format [pdf]
#159Earlier quoted context omitted.
I was crossing my fingers for that too. I create JSON files a lot. It's annoying when I'm _reordering_ elements separated by newlines. It's annoying when I'm generating JSON files and I have to code in a special case to skip the comma. It breaks the consistency that I just desire as a programmer.
Why do you manually code json?
Re: ECMA-404: The JSON Data Interchange Format [pdf]
#160I really (really really) wish they'd added a way to represent dates. Dates were left out of the original JSON spec since javascript doesn't define a syntax for date literals. You have to execute the Date() constructor to make them. Since JSON was supposed to be a subset of non-executing javascript, dates were excluded from JSON. That left serialization to a string as the only way to transfer dates. But since there's…
Wrong! Since ECMAScript 5 there is a single, standard format that all browsers will try to parse first and can predictably output: ISO 8601.
--
[02:49:29.621] (new Date()).toISOString()
[02:49:29.623] "2013-10-12T01:49:29.623Z"
--
[02:49:40.233] JSON.stringify(new Date())
[02:49:40.245] ""2013-10-12T01:49:40.246Z""