This php tutorial discusses about pretty printing json in php.
Read more »
I admit json format is self-descriptive and easy on human eyes. But have you ever created json data and tried printing or storing it in a file? Well! I'm sure you wouldn't say it human-friendly anymore if you take a look on it. All those cluttered characters and braces without proper indentation is a nightmare to read - to say the least.
A while back I tried for a php script to export mysql to json to backup data and use it for later. When I had a look on the file, what I see is this one...
{"a":"ABC","p":"PQR","X":"XYZ"}
instead of something like this with proper indentation and white-space and all...
{
"a": "ABC",
"p": "PQR",
"X": "XYZ"
}
0 Response to "How to Pretty Print JSON in PHP"
Posting Komentar