Giter Club home page Giter Club logo

jsonprima's Introduction

JSONPrima

RFC 8259 compliant JSON validator in Rust.

Documentation:

Code Status

Build Status Conventional Commits

Library

This package can be used as library in Rust projects. See the API reference (docs.rs) for more info.

CLI

You can grab the latest release of the binary on GitHub.

Pass the JSON document to validate as argument using the -i option.

$ jsonprima -i "[true, false]"
[]

The returned value is an JSON array with the returned errors as described bellow:

interface Error {
  code: string,
  description: string,
  index_start: number,
  index_end: number
}

In the above example the JSON document is valid, so the array does not contain any errors.

Here is an example of a wrong JSON document:

$ jsonprima -i "trua"
"[{\"code\": \"E105\", \"description\": \"Invalid character in literal name.\", \"index_end\": 4, \"index_start\": 0}]"

Note: This is a non-tolerant parser, expect that there will be at most one error in the returned array.

License

JSONPrima is primarily distributed under the terms of the MIT license.

See LICENSE.md for details.

jsonprima's People

Contributors

georgegkas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

jsonprima's Issues

Request for E106

First of all, I'm surprised this tool isn't more popular. :)

Request:

Currently E106 prints the index of the invalid literal, but I think it might be more user friendly to include the value of the literal as well as a field in the output. Thoughts?

"[{\"code\": \"E106\", \"description\": \"Invalid literal.\", \"index_end\": 1, \"index_start\": 0}]"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.