@@ -40,6 +40,8 @@ in your source code to use JSON Pointer.
4040#include < iostream>
4141#include < array>
4242
43+ using namespace format ;
44+
4345// Create a JSON pointer object
4446json_pointer jp (L"/foo/1");
4547
@@ -57,9 +59,9 @@ json j = L"{ \"foo\": [\"bar\", \"baz\"],\
5759// Get the value the pointer refers to
5860value & v = jp.value (j);
5961
60- std::wcout << v.as<const wchar_t * >() << std::endl;
62+ std::wcout << v.as<const wchar_t * > () << std::endl;
6163// ouput: baz
62-
64+
6365// Create an array of JSON pointers
6466std::array<format::json_pointer, 13> jp_list = {
6567 // pointer: // output:
@@ -81,16 +83,16 @@ std::array<format::json_pointer, 13> jp_list = {
8183for (auto& jp : jp_list)
8284 {
8385 try {
84- // Look for the value in the JSON object
85- format:: json::value & v = jp.value (j);
86-
86+ // Get the value the pointer refers to
87+ json::value & v = jp.value (j);
88+
8789 // If value is not found, object type is undefined
88- if (v.type () == format::json:: value::undefined_t)
90+ if (v.type () == value::undefined_t)
8991 std::wcout << "Value not found" << std::endl;
9092 else
9193 std::wcout << v.stringify () << std::endl;
92-
93- } catch (format:: json_pointer_error & e) {
94+
95+ } catch (json_pointer_error & e) {
9496 // Invalid pointer syntax or
9597 // a pointer that references a nonexistent value
9698 std::wcerr << e.what () << std::endl;
0 commit comments