MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / testJSON

Function testJSON

Source/JSON/jsonhelper.cpp:33–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31#include <iostream>
32
33void testJSON() {
34 std::string testString = "{ \"encoding\" : \"UTF-8\", \"plug-ins\" : [ \"python\", \"c++\", \"ruby\" ],\"indent\" : { \"length\" : 3, \"use_space\": true } }";
35
36 Json::Value root;
37
38 // Json::Value::Members members = root.getMemberNames();
39
40 Json::Reader reader;
41
42 if (reader.parse(testString, root)) {
43 std::cout << "Parse ok" << std::endl;
44 } else {
45 std::cout << "Parse NOT ok" << std::endl;
46 }
47
48 Json::ValueType type = root.type();
49
50 std::cout << "Type is: " << type << std::endl;
51
52 // std::cout << root.asString() << std::endl;
53
54 Json::Value::Members members = root.getMemberNames();
55
56 for (auto& member : members) {
57 std::cout << member << std::endl;
58 }
59}
60
61/*******
62 *

Callers

nothing calls this directly

Calls 3

parseMethod · 0.45
typeMethod · 0.45
getMemberNamesMethod · 0.45

Tested by

no test coverage detected