--- source: crates/rome_formatter_test/src/snapshot_builder.rs info: test_file: json/json5-as-json-with-trailing-commas/nested-quotes.json --- # Input ```json {"allOn": "Single", "Line": "example", "noSpace":true, "quote": { 'singleQuote': 'exa"mple', "indented": true, }, "phoneNumbers": [ {"type'": "home", "number\"": "212 555-1234"}, {"type": "office", "trailing": "commas by accident"}, ], } ``` # Prettier differences ```diff --- Prettier +++ Rome @@ -1,13 +1,13 @@ -{ - "allOn": "Single", - "Line": "example", - "noSpace": true, +{"allOn": "Single", "Line": "example", +"noSpace":true, "quote": { - "singleQuote": "exa\"mple", - "indented": true + 'singleQuote': 'exa"mple', + "indented": true, }, "phoneNumbers": [ - { "type'": "home", "number\"": "212 555-1234" }, - { "type": "office", "trailing": "commas by accident" } - ] + {"type'": "home", + "number\"": "212 555-1234"}, + {"type": "office", + "trailing": "commas by accident"}, + ], } ``` # Output ```json {"allOn": "Single", "Line": "example", "noSpace":true, "quote": { 'singleQuote': 'exa"mple', "indented": true, }, "phoneNumbers": [ {"type'": "home", "number\"": "212 555-1234"}, {"type": "office", "trailing": "commas by accident"}, ], } ``` # Errors ``` nested-quotes.json:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × JSON standard does not allow single quoted strings 2 │ "noSpace":true, 3 │ "quote": { > 4 │ 'singleQuote': 'exa"mple', │ ^^^^^^^^^^^^^ 5 │ "indented": true, 6 │ }, i Use double quotes to escape the string. nested-quotes.json:4:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × JSON standard does not allow single quoted strings 2 │ "noSpace":true, 3 │ "quote": { > 4 │ 'singleQuote': 'exa"mple', │ ^^^^^^^^^^ 5 │ "indented": true, 6 │ }, i Use double quotes to escape the string. nested-quotes.json:5:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × End of file expected 3 │ "quote": { 4 │ 'singleQuote': 'exa"mple', > 5 │ "indented": true, │ ^^^^^^^^^^ 6 │ }, 7 │ "phoneNumbers": [ i Use an array for a sequence of values: `[1, 2]` nested-quotes.json:5:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × End of file expected 3 │ "quote": { 4 │ 'singleQuote': 'exa"mple', > 5 │ "indented": true, │ ^ 6 │ }, 7 │ "phoneNumbers": [ i Use an array for a sequence of values: `[1, 2]` nested-quotes.json:5:31 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × End of file expected 3 │ "quote": { 4 │ 'singleQuote': 'exa"mple', > 5 │ "indented": true, │ ^^^^ 6 │ }, 7 │ "phoneNumbers": [ i Use an array for a sequence of values: `[1, 2]` nested-quotes.json:5:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × End of file expected 3 │ "quote": { 4 │ 'singleQuote': 'exa"mple', > 5 │ "indented": true, │ ^ > 6 │ }, │ ^^ 7 │ "phoneNumbers": [ 8 │ {"type'": "home", i Use an array for a sequence of values: `[1, 2]` nested-quotes.json:7:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × End of file expected 5 │ "indented": true, 6 │ }, > 7 │ "phoneNumbers": [ │ ^^^^^^^^^^^^^^ 8 │ {"type'": "home", 9 │ "number\"": "212 555-1234"}, i Use an array for a sequence of values: `[1, 2]` nested-quotes.json:7:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × End of file expected 5 │ "indented": true, 6 │ }, > 7 │ "phoneNumbers": [ │ ^ 8 │ {"type'": "home", 9 │ "number\"": "212 555-1234"}, i Use an array for a sequence of values: `[1, 2]` nested-quotes.json:12:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected an array, an object, or a literal but instead found ']' 10 │ {"type": "office", 11 │ "trailing": "commas by accident"}, > 12 │ ], │ ^ 13 │ } 14 │ i Expected an array, an object, or a literal here 10 │ {"type": "office", 11 │ "trailing": "commas by accident"}, > 12 │ ], │ ^ 13 │ } 14 │ nested-quotes.json:7:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × End of file expected 5 │ "indented": true, 6 │ }, > 7 │ "phoneNumbers": [ │ ^ > 8 │ {"type'": "home", > 9 │ "number\"": "212 555-1234"}, > 10 │ {"type": "office", > 11 │ "trailing": "commas by accident"}, > 12 │ ], │ ^ 13 │ } 14 │ i Use an array for a sequence of values: `[1, 2]` nested-quotes.json:12:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × End of file expected 10 │ {"type": "office", 11 │ "trailing": "commas by accident"}, > 12 │ ], │ ^ > 13 │ } │ ^ 14 │ i Use an array for a sequence of values: `[1, 2]` ```