4 ms·
"Parsing json is easy" https://seriot.ch/projects/parsing_json.html https://seriot.ch/projects/parsing_json.html https://raw.githubusercontent.com/nst/JSONTes
by avereveard 4y ago
"Parsing json is easy"
https://seriot.ch/projects/parsing_json.html https://seriot.ch/projects/parsing_json.html
https://raw.githubusercontent.com/nst/JSONTestSuite/master/results/pruned_results.png https://raw.githubusercontent.com/nst/JSONTestSuite/master/r...
- netgusto 4y agoThis is not claimed by the article afaict. It's stated though that json spec/syntax is simple, and that it's simple as a language; my interpretation is that this means "simple/understandable/predictable for humans".
- CipherThrowaway 4y agoI was at a place 7-8 years ago with a hand-rolled JSON parser that had been written across a few afternoons by one guy without much ceremony. It was untouched after that aside from some renaming and other minor refactors. As usual with these things, the decision to hand-roll was made by one very opinionated dev who got his way because the business depended on him. When that article was published it started an argument among the team. The guy ended up implementing the test suite to defend his decision. To my surprise the parser passed all tests apart from 3 or 4 unicodey-ones where it was more permissive than it should have been. There were plenty of production bugs at this place but none of them were due to the parser. IMO parsing JSON really is simple. If you read through the article you'll see that most of the test cases are dead simple and hardly landmines.
- shp0ngle 4y agoJSON is a subset of YAML. (you can just dump JSON in your YAML document and it’s a valid YAML.) So parsing YAML will be strictly harder, as it needs to include a JSON parser.
- jefftk 4y agoIf language A is a subset of language B it doesn't follow that parsing B is strictly harder. This is not guaranteed. Consider two languages: 1. Some number of "a" followed by the same number of "b". For example, aaabbb but not aabbb. 2. Any number of "a" followed by any number of "b". For example, aabbb but not aba. In this case (1) is a subset of (2), but parsing (2) is easier than parsing (1) since in (1) you have to verify that the numbers match (which, in technical terms, means its not regular).