Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- virtual void printJson (json_value *node, int indent=0, const string & name = NULL)
- {
- if (node != NULL)
- {
- switch (node->type)
- {
- case json_null:
- cout<<"NULL" << endl;
- break;
- case json_boolean:
- cout<<"BOOLEAN: " << node->u.boolean << endl;
- break;
- case json_integer:
- cout<<"INTEGER: " << node->u.integer << endl;
- break;
- case json_double:
- cout<<"DOUBLE: " << node->u.dbl << endl;
- break;
- case json_string:
- cout<<"STRING: " << new string (node->u.string.ptr) << endl;
- break;
- case json_object:
- cout<<"OBJECT: " << endl;
- for (int i=0; i <node->u.object.length; i++)
- {
- printJson(node->u.object.values[i].value, indent + 1, node->u.object.values[i].name);
- }
- break;
- case json_array:
- cout<<"ARRAY: " << endl;
- for (int i=0; i <node->u.array.length; i++)
- {
- printJson(node->u.array.values[i], indent + 1);
- }
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement