A JSON data parser.
More...
#include <json.h>
|
| static QVariant | parse (const QString &json) |
| static QVariant | parse (const QString &json, bool &success) |
| static QByteArray | serialize (const QVariant &data) |
| static QByteArray | serialize (const QVariant &data, bool &success) |
|
| static QVariant | parseValue (const QString &json, int &index, bool &success) |
| static QVariant | parseObject (const QString &json, int &index, bool &success) |
| static QVariant | parseArray (const QString &json, int &index, bool &success) |
| static QVariant | parseString (const QString &json, int &index, bool &success) |
| static QVariant | parseNumber (const QString &json, int &index) |
| static int | lastIndexOfNumber (const QString &json, int index) |
| static void | eatWhitespace (const QString &json, int &index) |
| static int | lookAhead (const QString &json, int index) |
| static int | nextToken (const QString &json, int &index) |
A JSON data parser.
Json parses a JSON data into a QVariant hierarchy.
◆ eatWhitespace()
| void QtJson::Json::eatWhitespace |
( |
const QString & | json, |
|
|
int & | index ) |
|
staticprivate |
Skip unwanted whitespace symbols starting from index
- Parameters
-
| json | The JSON data |
| index | The start index |
eatWhitespace
◆ lastIndexOfNumber()
| int QtJson::Json::lastIndexOfNumber |
( |
const QString & | json, |
|
|
int | index ) |
|
staticprivate |
Get the last index of a number starting from index
- Parameters
-
| json | The JSON data |
| index | The starting index |
- Returns
- The last index of the number
lastIndexOfNumber
◆ lookAhead()
| int QtJson::Json::lookAhead |
( |
const QString & | json, |
|
|
int | index ) |
|
staticprivate |
Check what token lies ahead
- Parameters
-
| json | The JSON data |
| index | The starting index |
- Returns
- int The upcoming token
lookAhead
◆ nextToken()
| int QtJson::Json::nextToken |
( |
const QString & | json, |
|
|
int & | index ) |
|
staticprivate |
Get the next JSON token
- Parameters
-
| json | The JSON data |
| index | The starting index |
- Returns
- int The next JSON token
nextToken
◆ parse() [1/2]
| QVariant QtJson::Json::parse |
( |
const QString & | json | ) |
|
|
static |
Parse a JSON string
- Parameters
-
parse
◆ parse() [2/2]
| QVariant QtJson::Json::parse |
( |
const QString & | json, |
|
|
bool & | success ) |
|
static |
Parse a JSON string
- Parameters
-
| json | The JSON data |
| success | The success of the parsing |
parse
◆ parseArray()
| QVariant QtJson::Json::parseArray |
( |
const QString & | json, |
|
|
int & | index, |
|
|
bool & | success ) |
|
staticprivate |
Parses an array starting from index
- Parameters
-
| json | The JSON data |
| index | The starting index |
| success | The success of the array parse |
- Returns
- QVariant The parsed variant array
parseArray
◆ parseNumber()
| QVariant QtJson::Json::parseNumber |
( |
const QString & | json, |
|
|
int & | index ) |
|
staticprivate |
Parses a number starting from index
- Parameters
-
| json | The JSON data |
| index | The starting index |
- Returns
- QVariant The parsed number
parseNumber
◆ parseObject()
| QVariant QtJson::Json::parseObject |
( |
const QString & | json, |
|
|
int & | index, |
|
|
bool & | success ) |
|
staticprivate |
Parses an object starting from index
- Parameters
-
| json | The JSON data |
| index | The start index |
| success | The success of the object parse |
- Returns
- QVariant The parsed object map
parseObject
◆ parseString()
| QVariant QtJson::Json::parseString |
( |
const QString & | json, |
|
|
int & | index, |
|
|
bool & | success ) |
|
staticprivate |
Parses a string starting from index
- Parameters
-
| json | The JSON data |
| index | The starting index |
| success | The success of the string parse |
- Returns
- QVariant The parsed string
parseString
◆ parseValue()
| QVariant QtJson::Json::parseValue |
( |
const QString & | json, |
|
|
int & | index, |
|
|
bool & | success ) |
|
staticprivate |
Parses a value starting from index
- Parameters
-
| json | The JSON data |
| index | The start index |
| success | The success of the parse process |
- Returns
- QVariant The parsed value
parseValue
◆ serialize() [1/2]
| QByteArray QtJson::Json::serialize |
( |
const QVariant & | data | ) |
|
|
static |
This method generates a textual JSON representation
- Parameters
-
| data | The JSON data generated by the parser. |
| success | The success of the serialization |
◆ serialize() [2/2]
| QByteArray QtJson::Json::serialize |
( |
const QVariant & | data, |
|
|
bool & | success ) |
|
static |
This method generates a textual JSON representation
- Parameters
-
| data | The JSON data generated by the parser. |
| success | The success of the serialization |
- Returns
- QByteArray Textual JSON representation
The documentation for this class was generated from the following files: