[−][src]Crate jsonprima
jsonprima
is a RFC 8259 compliant JSON validator in Rust.
This module comes as a Cargo library or CLI version.
CLI Usage
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.
Structs
Error | Error type of validation functions. |
Enums
ErrorType | A list of all error variants used by this module. |
Functions
validate | Validate a JSON document based on RFC 8259 latest standard. |