Created
May 30, 2016 20:56
-
-
Save comm1x/b294c27c41227146ff821e51dccfddd7 to your computer and use it in GitHub Desktop.
JsonLint - bash utility for linting input json
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
#!/usr/bin/env php | |
<?php | |
$file = fopen('php://stdin', 'r'); | |
$lines = ''; | |
while ($line = fgets($file)) { | |
$lines .= $line; | |
} | |
$array = json_decode($lines, true); | |
echo json_encode($array, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment