JSON syntax checker command line utility and library for Node.js
CSS JavaScript
Permalink
Failed to load latest commit information.
bin Initial commit Jun 24, 2014
lib Initial commit Jun 24, 2014
test Initial commit Jun 24, 2014
.gitignore Initial commit Jun 24, 2014
.jshintrc Initial commit Jun 24, 2014
.npmignore Initial commit Jun 24, 2014
.travis.yml Initial commit Jun 24, 2014
LICENSE.txt Initial commit Jun 24, 2014
README.md Updated build status link Jun 24, 2014
package.json Initial commit Jun 24, 2014

README.md

Syntax Checker for JSON

Build Status

The 'hello world' of JSON processing, jsonSyntax provides a library to determine whether a file contains valid JSON syntax or not.

For command line/script use, a console message is displayed and the process exits with 0 for success, 1 for failure.

Command Line / Script Use

To run the syntax checker (command line or script), use the jsonsyntax command with a file name (path optional). For example, to check the file example.json, use,

jsonsyntax example.json

Library Function Use

To use the syntax checker as a library function, call the syntaxCheck function in a try/catch block. For example,

var checkSyntax = require ("jsonSyntax").checkSyntax;
try {
    checkSyntax ("example.json");
    console.log ("Valid JSON file");
} catch (e) {
    console.log ("Error: " + e.message);
}

Installation

The program can be installed using npm, with the command,

npm -g install ujs-jsonsyntax

Use of the -g parameter will install it in the global system repository, allowing command line / script use from any location on the system.

Project

jsonsyntax is part of the Using JSON Schema project.

License

MIT