285 {
287
288 char json[] =
" { \"hello\" : \"world\", \"t\" : true , \"f\" : false, \"n\": null,"
289 "\"i\":123, \"pi\": 3.1416, \"a\":[-1, 2, 3, 4, \"array\", []], \"skipArrays\":[1, 2, [[[3]]]], "
290 "\"skipObject\":{ \"i\":0, \"t\":true, \"n\":null, \"d\":123.45 }, "
291 "\"skipNested\":[[[[{\"\":0}, {\"\":[-9.87]}]]], [], []], "
292 "\"skipString\":\"zzz\", \"reachedEnd\":null, \"t\":true }";
293
295
297
298 r.EnterObject();
299 while (
const char*
key = r.NextObjectKey()) {
300 if (0 == strcmp(
key,
"hello")) {
302 cout <<
key <<
":" << r.GetString() << endl;
303 }
304 else if (0 == strcmp(
key,
"t") || 0 == strcmp(
key,
"f")) {
306 cout <<
key <<
":" << r.GetBool() << endl;
307 continue;
308 }
309 else if (0 == strcmp(
key,
"n")) {
311 r.GetNull();
313 continue;
314 }
315 else if (0 == strcmp(
key,
"pi")) {
317 cout <<
key <<
":" << r.GetDouble() << endl;
318 continue;
319 }
320 else if (0 == strcmp(
key,
"a")) {
322
323 r.EnterArray();
324
325 cout <<
key <<
":[ ";
326 while (r.NextArrayValue()) {
328 cout << r.GetDouble() << " ";
329 }
331 cout << r.GetString() << " ";
332 }
333 else {
334 r.SkipArray();
335 break;
336 }
337 }
338
339 cout << "]" << endl;
340 }
341 else {
342 cout <<
key <<
":skipped" << endl;
343 r.SkipValue();
344 }
345 }
346
347 return 0;
348}
#define RAPIDJSON_ASSERT(x)
Assertion.