3 ms·
Knowing simply that something uses JSON syntax is itself insufficient to actually do anything with the data. Sorry, but you cannot escape communicating semantic
by BugsJustFindMe 5y ago
Knowing simply that something uses JSON syntax is itself insufficient to actually do anything with the data. Sorry, but you cannot escape communicating semantic understanding by throwing a "parts are JSON" mimetype header on it. JSON is just not a self-describing format, so you really can't escape the fact that it's only ever useful when either talking to yourself or when the sender is already saying "and when I say 'age' that is a number of months and means..." In both cases you already know that the messages are formatted with JSON.
- nerdponx 5y agoThere are 3 layers here: 1. Records separated by ASCII "\n" characters, wherein each record cannot contain an "\n" character 2. Each record is UTF-8 text in JSON format 3. The schema of each record is <something> ND-JSON takes care of the first two. You would still have to use JSONSchema for the third. This is not very different from using JSON without the "ND" part. Except: 1. Now there's the "ND" part, and I have something standardized I can use for quick and easy understanding/agreement when collaborating, especially outside my organization. 2. Plain JSON supports exactly 1 record per stream or file. ND-JSON supports any natural number of records, or an infinite number of records. That's useful to me. I really don't understand the resistance here. Nobody is trotting this out claiming its some hot new thing. It's an unoffensive standardization of a pretty basic data format that people have been using for 10+ years. If you have no use for it, then just ignore it. Consider that the people using it might not be morons; they might just have different needs that are different from yours.
- BugsJustFindMe 5y ago> 2. Plain JSON supports exactly 1 record per stream or file. Unless you wrap it in an array, which is all this is doing.
- nerdponx 5y agoNo, that is not "all this is doing". A JSON array is exactly 1 "record", in that it must be parsed entirely before it can be interpreted as anything other than a string of text. Moreover, you can write a ND-JSON file where each record is an array. The following is valid ND-JSON: ["a", "b", "c"] ["u", "v"] ["x", "y", "z"]
- wolfgang42 5y ago> must be parsed entirely Streaming JSON parsers do exist, but they’re rather specialized and harder to use than JSON.parse(). The advantage of ND-JSON is that you can get the same effect in a much simpler way.