Вот краткое описание:
function jdump($thing) {
printf("%s\n\n", json_encode($thing, JSON_PRETTY_PRINT));
}
jdump(['foo', 'bar']);
jdump(['foo' => 'bar']);
jdump([['a' => 1],['b' => 2],['c' => 3]]);
Вывод:
[
"foo",
"bar"
]
{
"foo": "bar"
}
[
{
"a": 1
},
{
"b": 2
},
{
"c": 3
}
]