Class JSONData
#include <JSONData.h >
Super class: XMLData
This class represent hierarchical JSON data.
JSON properties are encapsulated in a HashArray class for any JSON node.
The data structure can be serialized using toString() and loaded from text using fromString().
Constructor. Create an empty hierarchical data structure.
Each level of hierarchy has a number of properties and child nodes.
XMLData& xml |
XML data to convert |
Constructor. Covnert an hierarchical data structure from XML data.
Each level of hierarchy has a number of properties and child nodes.
const string& xmltext |
a serialized JSONData, HashArray or XMLData value |
This constructor accepts serialized JSONData, HashArray, and XMLData text and converts into into this structure.
const string& key |
the name of the sub-nodes to look for |
Given a child node name, return the node of that child. If more than one sub-node exists, return the first one.
Return value: child node; if not found, returns an empty node (valid() returns null false)
const string& key |
the name of the sub-nodes to look for |
Given a child node name, return the node of that child. If more than one sub-node exists, return the first one.
Return value: child node (as a const); if not found, returns an empty node (valid() returns null false)
const string& key |
name of the array |
const string& value |
new value to add to the array |
Add a value to an array. Note that you are responsible to make sure
all the values are of the same type (number, string, object).
Return value: the instance provided (not the array element)
const string& key |
name of the array |
const JSONData& object |
new object to add to the array |
Add an object to an array. Note that you are responsible to make sure
all the objects are of the same.
Return value: the instance provided (not the array element)
const string& key |
name of the array |
Return the number of elements in a named array.
Return value: the array size
const string& key |
name of the array |
int index |
the array element number, e.g. 0+ |
Get an array value.
Return value: the instance provided (not the array element)
const string& key |
name of the array |
int index |
the array element number, e.g. 0+ |
Get an array object.
Return value: the instance provided (not the array element)
Convert the node and all sub-nodes into serialized text.
Return value: the JSONData, serialized as text
string& result |
(output) the serialized text |
Convert the node and all sub-nodes into serialized text into the provided string.
Return value: the resulting output in the result parameter
string text |
XML as text to convert into our structure |
Convert serialized JSONData text into the current JSONData structure, clearing any previous data.
Return value: true if data fully loaded
Convert to text in XML.
Return value: text string in XML form representing the data
const string& text |
Used by toString() to generate a quoted string (with escapes)
string& text |
|
char quotechar |
Parsing methods used by fromString()
string& text |
string& text |
string& text |
const string& key |
|
string& text |
string& text |