SPT JSON API
1.0.0
Developed by Sans Pareil Technologies, Inc. (SPT)
|
Classes that deal with parsing and generating JSON data. More...
Classes | |
class | DefaultHandler |
A default handler that populates a Json instance with the JSON data being parsed. More... | |
struct | Handler |
Streaming handler interface for parsing JSON data streams. More... | |
struct | Reader |
Base JSON data reader interface. Implementations provide support for reading JSON data from various sources. Event notifications will be sent to the callback handler set for the reader. Handler instances may be updated during the course of data parsing. More... | |
class | StreamReader |
JSON data parser for streams. More... | |
class | StreamWriter |
Writer for serialising spt::json::Json instances. More... | |
class | StringReader |
JSON data reader from strings. More... | |
class | StringWriter |
Writer for serialising spt::json::Json instances. More... | |
struct | Writer |
Base writer for serialising spt::json::Json instances. More... | |
Functions | |
Value::Ptr | read (std::istream &stream) |
Value::Ptr | fromFile (const std::string &path) |
Value::Ptr | read (const std::string &json) |
void | toFile (const spt::json::Object &object, const std::string &filePath, bool prettyPrint=false, std::string decorator=std::string(" ")) |
void | toFile (const spt::json::Array &array, const std::string &filePath, bool prettyPrint=false, std::string decorator=std::string(" ")) |
Classes that deal with parsing and generating JSON data.
|
inline |
Convenience function to read data from a file as the specified path into JSON object/array.
path | The path to the file to read. |
unique_ptr
to object/array. std::runtime_error | If JSON data is invalid. |
Value::Ptr spt::json::io::read | ( | std::istream & | stream | ) |
Convenience function to read data from the specified stream into JSON object/array.
stream | The stream from which the JSON data will be read. |
unique_ptr
to object/array. std::runtime_error | If JSON data is invalid. |
Value::Ptr spt::json::io::read | ( | const std::string & | json | ) |
Convenience function to read data from the specified string into JSON object/array.
json | The string from which the JSON data will be read. |
unique_ptr
to object/array. std::runtime_error | If JSON data is invalid. |
void spt::json::io::toFile | ( | const spt::json::Object & | object, |
const std::string & | filePath, | ||
bool | prettyPrint = false , |
||
std::string | decorator = std::string(" ") |
||
) |
Write the specified JSON object to the specified file.
object | The JSON object to serialise |
filePath | The path to the file to write the JSON data to. |
prettyPrint | Indicate whether output should be formatted for human readability. |
decorator | The formatting string to be used to format the output. |
std::runtime_error | If the file is not writable to. |
void spt::json::io::toFile | ( | const spt::json::Array & | array, |
const std::string & | filePath, | ||
bool | prettyPrint = false , |
||
std::string | decorator = std::string(" ") |
||
) |
Write the specified JSON array to the specified file.
array | The JSON array to serialise |
filePath | The path to the file to write the JSON data to. |
prettyPrint | Indicate whether output should be formatted for human readability. |
decorator | The formatting string to be used to format the output. |
std::runtime_error | If the file is not writable to. |