diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2013-09-05 07:55:49 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-17 08:07:25 +0200 |
commit | 89ef515177fd5a0b5d95dcffd5fd0b0669e3625a (patch) | |
tree | 0fb87c82c882168141c1194dabbc47915f10eb98 /tests/auto/tools/qmake/testdata/json/test.json | |
parent | f47958fa148d6ea9ece0bec3ca9ba67d9c68ea19 (diff) |
Add JSON parsing support to qmake.
Add qjson* implementation files from corelib/json
to the qmake build. Add a read-only compile mode,
enabled by defining QT_JSON_READONLY.
Add qmake built-in function parseJson(file, into)
which parses a json file into the given variable.
qmake uses a flat key -> value-list implementation
for storing variables, which means that some hackery
is need to represent arbitrarily nested JSON. Use a
special "_KEYS_" variable for arrays and objects:
Arrays:
["item1", "item2"]
$${array._KEYS_} -> 0 1 2
$${array.0} -> "item1"
$${array.1} -> "item2"
Objects:
{ "key1" : "value1", "key2" : "value2" }
$${object._KEYS_} -> key1 key2
$${object.key1} -> value1
$${object.key2} -> value2
Change-Id: I0aa2e4e4ae14fa25be8242bc16d3cffce32504d2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto/tools/qmake/testdata/json/test.json')
-rw-r--r-- | tests/auto/tools/qmake/testdata/json/test.json | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/tools/qmake/testdata/json/test.json b/tests/auto/tools/qmake/testdata/json/test.json new file mode 100644 index 0000000000..cc82908eba --- /dev/null +++ b/tests/auto/tools/qmake/testdata/json/test.json @@ -0,0 +1,9 @@ +{ + "array" : ["arrayItem1", "arrayItem2", "arrayItem3"], + "object" : { "key1" : "objectValue1", "key2" : "objectValue2" }, + "string" : "test string", + "number" : 999, + "true" : true, + "false" :false, + "null" : null +} |