# How standard libraries read JSON files

9 JSON files from loremfile.dev, given to 4 standard-library readers in 13 runtime versions: which read them, which refuse, which differ.

The page: <https://loremfile.dev/compat/json>.

9 JSON files given to 4 readers in 13 runtime versions. Cells of the ordinary files: reads 78, differs 0, refuses 0, crashes 0.

| File | Manifest says | go/encoding/json | node/JSON | python/json | ruby/JSON | Java (no reader) |
|---|---|---|---|---|---|---|
| [`edge/json-bom.json`](https://loremfile.dev/edge/json-bom.json) (80 B) | nothing compared | 1.26: **refuses** with json.SyntaxError: invalid character 'ï' looking for beginning of value<br>1.27: **refuses** with json.SyntaxError: invalid character '\ufeff' looking for beginning of value | **refuses** with SyntaxError: Unexpected token '﻿', "﻿{ | **refuses** with json.decoder.JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0) | 3.3 to 3.4: **refuses** with JSON::ParserError: unexpected token at '﻿{<br>4.0: **refuses** with JSON::ParserError: unexpected character: '﻿{' at line 1 column 1 | **no-reader** |
| [`edge/json-trailing-comma.json`](https://loremfile.dev/edge/json-trailing-comma.json) (64 B) | nothing compared | **refuses** with json.SyntaxError: invalid character ']' looking for beginning of value (expected) | **refuses** with SyntaxError: Unexpected token ']', ..."e", "two",], (expected) | 3.11 to 3.12: **refuses** with json.decoder.JSONDecodeError: Expecting value: line 4 column 25 (char 59) (expected)<br>3.13 to 3.15: **refuses** with json.decoder.JSONDecodeError: Illegal trailing comma before end of array: line 4 column 24 (char 58) (expected) | 3.3 to 3.4: **refuses** with JSON::ParserError: unexpected token at '], (expected)<br>4.0: **refuses** with JSON::ParserError: unexpected character: '],' at line 3 column 25 (expected) | **no-reader** |
| [`edge/zero-byte.json`](https://loremfile.dev/edge/zero-byte.json) (0 B) | nothing compared | **refuses** with json.SyntaxError: unexpected end of JSON input (expected) | **refuses** with SyntaxError: Unexpected end of JSON input (expected) | **refuses** with json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) (expected) | 3.3 to 3.4: **refuses** with JSON::ParserError: unexpected token at '' (expected)<br>4.0: **refuses** with JSON::ParserError: unexpected end of input at line 1 column 1 (expected) | **no-reader** |
| [`json/10mb.json`](https://loremfile.dev/json/10mb.json) (10 MB (9,996,549 bytes)) | items 19368, top_type array | **reads** reports items 19368, top_type array | **reads** reports items 19368, top_type array | **reads** reports items 19368, top_type array | **reads** reports items 19368, top_type array | **no-reader** |
| [`json/1mb.json`](https://loremfile.dev/json/1mb.json) (997.7 KB (997,720 bytes)) | items 1942, top_type array | **reads** reports items 1942, top_type array | **reads** reports items 1942, top_type array | **reads** reports items 1942, top_type array | **reads** reports items 1942, top_type array | **no-reader** |
| [`json/all-types.json`](https://loremfile.dev/json/all-types.json) (708 B) | items 21, top_type object | **reads** reports items 21, top_type object | **reads** reports items 21, top_type object | **reads** reports items 21, top_type object | **reads** reports items 21, top_type object | **no-reader** |
| [`json/nested-100-levels.json`](https://loremfile.dev/json/nested-100-levels.json) (1.4 KB (1,380 bytes)) | items 1, top_type object | **reads** reports items 1, top_type object | **reads** reports items 1, top_type object | **reads** reports items 1, top_type object | **reads** reports items 1, top_type object | **no-reader** |
| [`json/people-10.json`](https://loremfile.dev/json/people-10.json) (5.2 KB (5,186 bytes)) | items 10, top_type array | **reads** reports items 10, top_type array | **reads** reports items 10, top_type array | **reads** reports items 10, top_type array | **reads** reports items 10, top_type array | **no-reader** |
| [`json/people-1000.json`](https://loremfile.dev/json/people-1000.json) (512.7 KB (512,687 bytes)) | items 1000, top_type array | **reads** reports items 1000, top_type array | **reads** reports items 1000, top_type array | **reads** reports items 1000, top_type array | **reads** reports items 1000, top_type array | **no-reader** |

Java has no reader for these files. The standard library has no JSON parser.

None of the 4 readers, in 4 runtimes, read edge/json-bom.json. Its outcome, varies, is what the format allows, not what these readers did.

The results as JSON: <https://github.com/kumarprabhashanand/loremfile/blob/main/compat/results/json.json>.
