1# JSON Parsing Test Suite 2A comprehensive test suite for RFC 8259 compliant JSON parsers 3 4This repository was created as an appendix to the article [Parsing JSON is a Minefield ](http://seriot.ch/parsing_json.php). 5 6**/parsers/** 7 8This directory contains several parsers and tiny wrappers to turn the parsers into JSON validators, by returning a specific value. 9 10- `0` the parser did accept the content 11- `1` the parser did reject the content 12- `>1` the process did crash 13- `timeout` happens after 5 seconds 14 15**/test\_parsing/** 16 17The name of these files tell if their contents should be accepted or rejected. 18 19- `y_` content must be accepted by parsers 20- `n_` content must be rejected by parsers 21- `i_` parsers are free to accept or reject content 22 23**/test\_transform/** 24 25These files contain weird structures and characters that parsers may understand differently, eg: 26 27- huge numbers 28- dictionaries with similar keys 29- NULL characters 30- escaped invalid strings 31 32These files were used to produce `results/transform.html`. 33 34**/run_tests.py** 35 36Run all parsers with all files: 37 38 $ python3 run_tests.py 39 40Run all parsers with a specific file: 41 42 $ python3 run_tests.py file.json 43 44Run specific parsers with all files: 45 46 $ echo '["Python 2.7.10", "Python 3.5.2"]' > python_only.json 47 $ python3 run_tests.py --filter=python_only.json 48 49The script writes logs in `results/logs.txt`. 50 51The script then reads `logs.txt` and generates `results/parsing.html`. 52 53**/results/** 54 55<img src="results/pruned_results.png" alt="JSON Parsing Tests" /> 56