- json_encode: documentation ( source)
<?php
$x = [
'create' => [
['table' => 'news'],
'id',
['title', 'varchar'],
['published_at', 'date', 'index' => true],
['text', 'text']
]
];
echo json_encode($x, JSON_PRETTY_PRINT);