A basic JSON library in modern C++
MIT License
A basic JSON parser in modern C++ using only the standard library.
Just a modern Clang like Clang 12 on Fedora 34.
$ make
$ ./main '{"a": [1, 2, null, { "c": 129 }]}'
{
"a": [
1.000000,
2.000000,
null,
{
"c": 129.000000
}
]
}
$ ./main "$(cat ./test/cofax-bad.json)"
Unexpected token ',', type 'Syntax', index
Failed to parse at line 5, column 18
"servlet-class": ,"org.cofax.cds.CDSServlet",
^
Just two main functions.
This turns a string into a json::JSONValue
. If it fails, the second
element in the return tuple contains an error string.
This turns a json::JSONValue
back into a JSON string.