--- source: crates/rome_formatter_test/src/snapshot_builder.rs info: test_file: json/range/json-stringify/template-literal.json --- # Input ```json [ {a:`aaa`,n: ''}, {a:`a`,n: ''} ] ``` # Prettier differences ```diff --- Prettier +++ Rome @@ -1,10 +1,6 @@ [ - { - "a": "aaa", - "n": "" - }, - { - "a": "a", - "n": "" - } +{a:`aaa`,n: +''}, +{a:`a`,n: +''} ] ``` # Output ```json [ {a:`aaa`,n: ''}, {a:`a`,n: ''} ] ``` # Errors ``` template-literal.json:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Property key must be double quoted 1 │ [ > 2 │ {a:`aaa`,n: │ ^ 3 │ ''}, 4 │ {a:`a`,n: template-literal.json:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unexpected character ``` 1 │ [ > 2 │ {a:`aaa`,n: │ ^ 3 │ ''}, 4 │ {a:`a`,n: template-literal.json:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unexpected character ``` 1 │ [ > 2 │ {a:`aaa`,n: │ ^ 3 │ ''}, 4 │ {a:`a`,n: template-literal.json:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Property key must be double quoted 1 │ [ > 2 │ {a:`aaa`,n: │ ^ 3 │ ''}, 4 │ {a:`a`,n: template-literal.json:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × JSON standard does not allow single quoted strings 1 │ [ 2 │ {a:`aaa`,n: > 3 │ ''}, │ ^^ 4 │ {a:`a`,n: 5 │ ''} i Use double quotes to escape the string. template-literal.json:4:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Property key must be double quoted 2 │ {a:`aaa`,n: 3 │ ''}, > 4 │ {a:`a`,n: │ ^ 5 │ ''} 6 │ ] template-literal.json:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unexpected character ``` 2 │ {a:`aaa`,n: 3 │ ''}, > 4 │ {a:`a`,n: │ ^ 5 │ ''} 6 │ ] template-literal.json:4:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unexpected character ``` 2 │ {a:`aaa`,n: 3 │ ''}, > 4 │ {a:`a`,n: │ ^ 5 │ ''} 6 │ ] template-literal.json:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Property key must be double quoted 2 │ {a:`aaa`,n: 3 │ ''}, > 4 │ {a:`a`,n: │ ^ 5 │ ''} 6 │ ] template-literal.json:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × End of file expected 2 │ {a:`aaa`,n: 3 │ ''}, > 4 │ {a:`a`,n: │ ^^^^^^^^^ 5 │ ''} 6 │ ] i Use an array for a sequence of values: `[1, 2]` template-literal.json:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × JSON standard does not allow single quoted strings 3 │ ''}, 4 │ {a:`a`,n: > 5 │ ''} │ ^^ 6 │ ] 7 │ i Use double quotes to escape the string. ```