Overview
Examples
Screenshots
Comparisons
Applications
Download
Manual
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Language
English













SourceForge.net Logo



JSON support

 

Value ParseJSON(CParser& p)

Parses JSON represented from p. It is possible to parse only part of whole text (e.g. when to parse just single element of array - parser then stops at the end of element. Elements of JSON are parsed into corresponding Value types, JSON objects are represented by ValueMap, JSON arrays by ValueArray. If input JSON is invalid throws CParser::Error.

 


 

Value ParseJSON(const char *s)

Parses JSON text s. Elements of JSON are parsed into corresponding Value types, JSON objects are represented by ValueMap, JSON arrays by ValueArray. If input JSON is invalid returns ErrorValue.

 


 

String AsJSON(int i)

String AsJSON(double n)

String AsJSON(bool b)

String AsJSON(const String& s)

String AsJSON(const WString& s)

String AsJSON(const char *s)

Converts basic values to JSON representation.

 


 

String AsJSON(const Value& v, const String& indent, bool pretty)

Encodes v as JSON, interpreting ValueMap as JSON object, ValueArray as JSON array. indent is prepended to each line. If pretty is true, JSON is encoded in lines, indenting each level of embedding, if it is false, JSON is as compact as possible..

 


 

String AsJSON(const Value& v, bool pretty = false)

Same as AsJSON(v, String(), pretty).

 

 

Json

 

class Json

Simple helper class intended for composing JSON strings. Json represents JSON object.

 

 

Constructor Detail

 

Json()

Default constructor. Creates empty JSON object.

 


 

Json(const char *key, const Value& value)

Json(const char *key, int i)

Json(const char *key, double n)

Json(const char *key, bool b)

Json(const char *key, const String& s)

Json(const char *key, const WString& s)

Json(const char *key, const char *s)

Json(const char *key, const Json& object)

Json(const char *key, const JsonArray& array)

Construct JSON object with single key-value pair.

 

 

Public Member List

 

String ToString() const

String operator~() const

operator String() const

Returns current JSON formatted text.

 


 

Json& operator()(const char *key, const Value& value)

Json& operator()(const char *key, int i)

Json& operator()(const char *key, double n)

Json& operator()(const char *key, bool b)

Json& operator()(const char *key, const String& s)

Json& operator()(const char *key, const WString& s)

Json& operator()(const char *key, const char *s)

Json& operator()(const char *key, const Json& object)

Json& operator()(const char *key, const JsonArray& array)

Adds key-value pair to JSON object.

 

 

 

 

Json

 

class JsonArray

Simple helper class intended for composing JSON strings, representing JSON array.

 

Constructor Detail

 

JsonArray()

Creates empty JSON array.

 

 

Public Member List

 

String ToString() const

String operator~() const

operator String() const

Returns current JSON formatted text.

 


 

JsonArray& operator<<(const Value& value)

JsonArray& operator<<(int i)

JsonArray& operator<<(double n)

JsonArray& operator<<(bool b)

JsonArray& operator<<(const String& s)

JsonArray& operator<<(const WString& s)

JsonArray& operator<<(const char *s)

JsonArray& operator<<(const Json& object)

JsonArray& operator<<(const JsonArray& array)

Adds an element to JSON array.

 

Last edit by cxl on 02/11/2012. Do you want to contribute?. T++