4 releases (2 breaking)

✓ Uses Rust 2018 edition

0.3.0 Aug 13, 2019
0.2.0 Jul 23, 2019
0.1.1 Jul 5, 2019
0.1.0 Jul 5, 2019

#103 in Testing

31 downloads per month

MIT license

73KB
1.5K SLoC

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.

Dependencies

~775KB
~12K SLoC