Newline for each item in JSON array
See original GitHub issueIs there an option to place each item in a JSON array on a new line regardless of the line of the length? I have quite a lot of the following:
[
["thing1"],
["thing2"]
]
And would like keep them this way instead of the whole thing becoming one line. I also think in general placing each item in an array on a new line is preferable.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:111
- Comments:61 (19 by maintainers)
Top Results From Across the Web
Add new line after each object in a JSON array when printing ...
This solution of adding additional line breaks between each of the properties in a JSON object seems to resolve the merge conflicts. The...
Read more >How to handle newlines in JSON ? - GeeksforGeeks
First, we need to declare a variable as “json1” and then we need to assign the JSON to it. · In JSON object...
Read more >array-element-newline - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Processing JSON with jq -- newline - Fullstack.io
If an index value is omitted, then all of the elements are returned by the array index filter: Additionally, the .[] filter can...
Read more >JSON - JavaScript - MDN Web Docs
All properties and methods of JSON are static (just like the Math object). JavaScript and JSON differences. JSON is a syntax for serializing...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
An idea worth discussing: What if we took the “3-or-more” rule from chained method calls and applied it to arrays (both in JS and in JSON)? One or two items would always be single-line (if it fits), while three or more items would always be multiline (even if it fits in a single line).
@maraisr that’s also fine in my opinion. Except it should be: