1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
6 \title JSON Support in Qt
7 \ingroup qt-basic-concepts
8 \brief An overview of JSON support in Qt.
10 \ingroup frameworks-technologies
14 Qt provides support for dealing with JSON data. JSON is a
15 format to encode object data derived from Javascript, but
16 now widely used as a data exchange format on the internet.
18 The JSON support in Qt provides an easy to use C++ API to parse,
19 modify and save JSON data.
21 More details about the JSON data format can be found at \l{http://json.org}{json.org}
28 JSON is a format to store structured data. It has 6 basic data types:
39 A value can have any of the above types. A boolean value is represented by the
40 strings true or false in JSON. JSON doesn't explicitly specify the valid range
41 for numbers, but the support in Qt is limited to the validity range and precision of
42 doubles. A string can be any valid unicode string. An array is a list of values, and an
43 object is a collection of key/value pairs. All keys in an object are strings, and
44 an object cannot contain any duplicate keys.
46 The text representation of JSON encloses arrays in square brackets ([ ... ]) and
47 objects in curly brackets ({ ... }). Entries in arrays and objects are separated by
48 commas. The separator between keys and values in an object is a colon (:).
50 A simple JSON document encoding a person, his/her age, address and phone numbers could
59 "Street": "Downing Street 10",
61 "Country": "Great Britain"
70 The above example consists of an object with 5 key/value pairs. Two of the values are strings,
71 one is a number, one is another object and the last one an array.
73 A valid JSON document is either an array or an object, so a document always starts
74 with a square or curly bracket.
76 \sa {JSON Save Game Example}
79 \section1 The JSON Classes
81 All JSON classes are value based,
82 \l{Implicit Sharing}{implicitly shared classes}.
84 JSON support in Qt consists of these classes: