Skip to content

Instantly share code, notes, and snippets.

@comm1x
Created May 30, 2016 20:56
Show Gist options
  • Save comm1x/b294c27c41227146ff821e51dccfddd7 to your computer and use it in GitHub Desktop.
Save comm1x/b294c27c41227146ff821e51dccfddd7 to your computer and use it in GitHub Desktop.
JsonLint - bash utility for linting input json
#!/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