json.h File Reference

Top-level entrypoints for reading and writing JSON. More...

+ Include dependency graph for json.h:

Go to the source code of this file.

Classes

struct  JsParseError
 A struct containing information about a JSON parsing error. More...
 
class  JsWriter
 This class provides an interface to writing json values directly to a stream. More...
 

Functions

JS_API JsValue JsParseStream (std::istream &istr, JsParseError *error=0)
 Parse the contents of input stream istr and return a JsValue. More...
 
JS_API JsValue JsParseString (const std::string &data, JsParseError *error=0)
 Parse the contents of the JSON string data and return it as a JsValue. More...
 
JS_API void JsWriteToStream (const JsValue &value, std::ostream &ostr)
 Convert the JsValue value to JSON and write the result to output stream ostr. More...
 
JS_API std::string JsWriteToString (const JsValue &value)
 Convert the JsValue value to JSON and return it as a string. More...
 
JS_API void JsWriteValue (JsWriter *writer, const JsValue &value)
 Write a json value. More...
 

Detailed Description

Top-level entrypoints for reading and writing JSON.

Definition in file json.h.

Function Documentation

◆ JsParseStream()

JS_API JsValue JsParseStream ( std::istream &  istr,
JsParseError error = 0 
)

Parse the contents of input stream istr and return a JsValue.

On failure, this returns a null JsValue.

◆ JsParseString()

JS_API JsValue JsParseString ( const std::string &  data,
JsParseError error = 0 
)

Parse the contents of the JSON string data and return it as a JsValue.

On failure, this returns a null JsValue.

◆ JsWriteToStream()

JS_API void JsWriteToStream ( const JsValue value,
std::ostream &  ostr 
)

Convert the JsValue value to JSON and write the result to output stream ostr.

◆ JsWriteToString()

JS_API std::string JsWriteToString ( const JsValue value)

Convert the JsValue value to JSON and return it as a string.

◆ JsWriteValue()

JS_API void JsWriteValue ( JsWriter writer,
const JsValue value 
)

Write a json value.