x This domain is for sale. If you intrested, Please contact : webspeckle@gmail.com

Is Qt supports JSON?

YES. Qt provides support for dealing with JSON data. JSON is a format to encode object data derived from Javascript, but now widely used as a data exchange format on the internet. The JSON support in Qt provides an easy to use C++ API to parse, modify and save JSON data. It also contains support for saving this data in a binary format that is directly "mmap"-able and very fast to access.

JSON is a format to store structured data. It has 6 basic data types:
bool, double, string, array, object, null
The text representation of JSON encloses arrays in square brackets ([ ... ]) and objects in curly brackets ({ ... }). Entries in arrays and objects are separated by commas. The separator between keys and values in an object is a colon (:).

A simple JSON document encoding a person, his/her age, address and phone numbers could look like:
{
    "FirstName": "John",
    "LastName": "Doe",
    "Age": 43,
    "Address": {
        "Street": "Downing Street 10",
        "City": "London",
        "Country": "Great Britain"
    },
    "Phone numbers": [
        "+44 1234567",
        "+44 2345678"
    ]
}
JSON support in Qt consists of these classes:
QJsonArrayEncapsulates a JSON array
QJsonDocumentWay to read and write JSON documents
QJsonParseErrorUsed to report errors during JSON parsing
QJsonObjectEncapsulates a JSON object
QJsonObject::const_iteratorQJsonObject::const_iterator class provides an STL-style const iterator for QJsonObject
QJsonObject::iteratorQJsonObject::iterator class provides an STL-style non-const iterator for QJsonObject
QJsonValueEncapsulates a value in JSON

No comments:

Post a Comment