K
K
kuzdman2019-04-15 15:30:40
JavaScript
kuzdman, 2019-04-15 15:30:40

How is it "convenient" to open a JSON file?

How can I display a json record in a convenient form?
To have indents, etc. In other words, to make the data easy to read.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
R
Radjah, 2019-04-15
@Radjah

Firefox can format JSON out of the box, for example. For your editor, look for a plugin that can do pretty print for JSON.
First result on google https://jsonformatter.org/json-pretty-print

M
Moses Fender, 2019-04-15
@mosesfender

Notepad++ with JSTool

N
NepeinAndrey, 2019-04-15
@NepeinAndrey

If you do not need to do any complex transformations, then you can use JSON.stringify(), whose third argument is a string type separator, which is substituted before each line, taking into account nesting.

A
Alexander, 2019-04-15
@NeiroNx

in browser

var data = {"test":1,"test2":[{"test3":3},{"test4":4}]};
var s = JSON.stringify(data,"\n",4);

result:
{
    "test": 1,
    "test2": [
        {
            "test3": 3
        },
        {
            "test4": 4
        }
    ]
}

A
Alexander Kirsanov, 2019-04-15
@KAA-habr

Try this. At the same time, you will tell me the result.
w2ui.com/web/demos/#!grid/grid-5

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question