D
D
Dmitry2015-05-20 01:11:48
PHP
Dmitry, 2015-05-20 01:11:48

How to make JSON readable?

There is a json file. It is updated from time to time by means of php. But also this file is often edited manually. But here's the trouble, after encoding to json through php, it becomes one line.
Is there a php class that turns this string into a human readable form?
For example
{
"foo":["bar","baz"],
"key":true
}

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mykola, 2015-05-20
@By_Engine

php.net/manual/en/function.json-encode.php See
options -> JSON_PRETTY_PRINT
json_encode($a, JSON_PRETTY_PRINT);

6
65536, 2015-05-20
@65536

in addition to the mentioned autoformat in the id: chris.photobooks.com/json/default.htm Jason's eye-pleasing painter, recognizes tables (when an array of objects with the same fields)

N
NeylonC2, 2020-11-17
@NeylonC2

Library (PHP) for formatting json into nicejson readable form

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question