Skip to content

Instantly share code, notes, and snippets.

@t1maccapp
t1maccapp / json-to-csv.php
Created October 26, 2015 22:04 — forked from Kostanos/json-to-csv.php
Convert JSON array file to CSV. Use the array keys as the first row. Command line using: json-to-csv.php json.filename > csv.filename
#!/usr/bin/php
<?php
/*
* Convert JSON file to CSV and output it.
*
* JSON should be an array of objects, dictionaries with simple data structure
* and the same keys in each object.
* The order of keys it took from the first element.
*
* Example: