This website requires JavaScript.
Explore
Help
Sign In
vitalif
/
prettier
Watch
1
Star
0
Fork
You've already forked prettier
0
Code
Issues
Pull Requests
Releases
Wiki
Activity
911d6c88e5
prettier
/
tests
/
json
/
single-line.json
2 lines
63 B
JSON
Raw
Normal View
History
Unescape
Escape
Add JSON support (#2173) * Add JSON support This fixes https://github.com/prettier/prettier/issues/1973 by using [json-to-ast] to parse JSON, then converting the AST into a mostly-Babylon AST, so as to piggyback on the existing printer logic. Identifiers and literals are currently printed verbatim from the input, but this could be improved upon later (at least for literals, not sure about identifiers). [json-to-ast]: https://github.com/vtrushin/json-to-ast * Rename `json-to-ast` parser to `json` See https://github.com/prettier/prettier/pull/2173#discussion_r122574644 * json: Use createError to have a pretty error See https://github.com/prettier/prettier/pull/2173#discussion_r122574748 * json: Transform AST without mutations See https://github.com/prettier/prettier/pull/2173#discussion_r122574690
2017-06-17 23:36:42 +03:00
{
"key1"
:
[
true
,
false
,
null
]
,
"key2"
:
{
"key3"
:
[
1
,
2
,
"3"
,
1e10
,
1e-3
]
}
}