Created
June 2, 2015 08:42
-
-
Save raulfraile/bb3616174c52cd6f077a to your computer and use it in GitHub Desktop.
JSON linter
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 | |
<<<CONFIG | |
packages: | |
- "seld/jsonlint: 1.3.1" | |
CONFIG; | |
use Seld\JsonLint\JsonParser; | |
$parser = new JsonParser(); | |
$json = file_get_contents($argv[1]); | |
$result = $parser->lint($json); | |
if (null === $result) { | |
return 0; | |
} | |
echo $result->getMessage(); | |
return 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment