Skip to content

Instantly share code, notes, and snippets.

@raulfraile
Created June 2, 2015 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raulfraile/bb3616174c52cd6f077a to your computer and use it in GitHub Desktop.
Save raulfraile/bb3616174c52cd6f077a to your computer and use it in GitHub Desktop.
JSON linter
<?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