Skip to content

usingjsonschema/ujs-jsonsyntax-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON Syntax Check

Part of the Using JSON Schema project.

The 'hello world' of JSON processing, check the syntax of a JSON file.

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

https://travis-ci.org/usingjsonschema/ujs-jsonsyntax-python.svg?branch=master

Command Line / Script Use

Usage: jsonsyntax filename - filename name of file to check (path optional)

To run the syntax checker (command line or script) against 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/except block. For example,

from jsonsyntax import checkSyntax
try :
    checkSyntax ("example.json")
    print ("Valid JSON file")
except as e:
    print ("Error: " + e.message);

Install

Installation using pip for Python 2 (2.7) or Python 3.

pip install ujs-jsonsyntax

License

MIT

About

JSON syntax checker command line utility and library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages