Wt
3.2.0
|
A JSON representation and parsing library. More...
Classes | |
class | Wt::Json::Array |
A JSON array. More... | |
class | Wt::Json::Object |
A JSON object. More... | |
class | Wt::Json::ParseError |
A parse error. More... | |
class | Wt::Json::Value |
A JSON value. More... | |
class | Wt::Json::TypeException |
Exception that indicates a type error. More... | |
Enumerations | |
enum | Wt::Json::Type { Wt::Json::NullType, Wt::Json::StringType, Wt::Json::BoolType, Wt::Json::NumberType, Wt::Json::ObjectType, Wt::Json::ArrayType } |
Enumeration for the type of a JSON value. More... | |
Functions | |
WT_API void | Wt::Json::parse (const std::string &input, Value &result) |
Parse function. | |
WT_API bool | Wt::Json::parse (const std::string &input, Value &result, ParseError &error) |
Parse function. | |
WT_API void | Wt::Json::parse (const std::string &input, Object &result) |
Parse function. | |
WT_API bool | Wt::Json::parse (const std::string &input, Object &result, ParseError &error) |
Parse function. |
A JSON representation and parsing library.
The JSON library contains data types to represent a JSON data structure (Value, Object and Array), and a JSON parser.
Usage example:
Json::Object result; Json::parse("{ " " \"a\": \"That's great\", " " \"b\": true " "}", result); std::cerr << "Size: " << result.size(); << std::endl; // Size: 2 WString s = result.get("a"); bool b = result.get("b"); std::cerr << "a: " << s << ", b: " << b << std::endl; // a: That's great, b: true
enum Wt::Json::Type |
Enumeration for the type of a JSON value.
void Wt::Json::parse | ( | const std::string & | input, |
Value & | result | ||
) |
Parse function.
This function parses the input string (which represents a JSON-encoded data structure) into the result
value. On success, the result value contains either an Array or Object.
ParseError | when the input is not a correct JSON structure. |
bool Wt::Json::parse | ( | const std::string & | input, |
Value & | result, | ||
ParseError & | error | ||
) |
void Wt::Json::parse | ( | const std::string & | input, |
Object & | result | ||
) |
Parse function.
This function parses the input string (which represents a JSON-encoded data structure) into the result
object.
ParseError | when the input is not a correct JSON structure. |
TypeException | when the JSON structure does not represent an Object. |
bool Wt::Json::parse | ( | const std::string & | input, |
Object & | result, | ||
ParseError & | error | ||
) |