Created
August 11, 2015 06:22
-
-
Save pingyen/f61a3aedb8a6e333b51a to your computer and use it in GitHub Desktop.
JSON Formatter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $path = '/path/to'; | |
| foreach(scandir($path) as $file) { | |
| if (substr($file, -5) === '.json') { | |
| $path2 = "$path/$file"; | |
| file_put_contents($path2, shell_exec("cat $path2 | python -m json.tool")); | |
| } | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment