How do I generate a JSON file from PHP array? [duplicate]

$jsonArray = json_encode(array);

Out of the box (but of course before that you should alter your array to be an associative one) 🙂

Leave a Comment