@@ -251,38 +251,34 @@ class element : protected internal::tape_ref {
251251#endif // SIMDJSON_EXCEPTIONS
252252
253253 /* *
254- * Get the value associated with the given JSON pointer.
254+ * Get the value associated with the given key.
255+ *
256+ * The key will be matched against **unescaped** JSON:
255257 *
256258 * dom::parser parser;
257- * element doc = parser.parse(R"({ "foo": { "a": [ 10, 20, 30 ] }})");
258- * doc["/foo/a/1"] == 20
259- * doc["/"]["foo"]["a"].at(1) == 20
260- * doc[""]["foo"]["a"].at(1) == 20
259+ * parser.parse(R"({ "a\n": 1 })")["a\n"].get<uint64_t>().value == 1
260+ * parser.parse(R"({ "a\n": 1 })")["a\\n"].get<uint64_t>().error == NO_SUCH_FIELD
261261 *
262- * @return The value associated with the given JSON pointer, or:
263- * - NO_SUCH_FIELD if a field does not exist in an object
264- * - INDEX_OUT_OF_BOUNDS if an array index is larger than an array length
265- * - INCORRECT_TYPE if a non-integer is used to access an array
266- * - INVALID_JSON_POINTER if the JSON pointer is invalid and cannot be parsed
262+ * @return The value associated with this field, or:
263+ * - NO_SUCH_FIELD if the field does not exist in the object
264+ * - INCORRECT_TYPE if this is not an object
267265 */
268- inline simdjson_result<element> operator [](const std::string_view &json_pointer ) const noexcept ;
266+ inline simdjson_result<element> operator [](const std::string_view &key ) const noexcept ;
269267
270268 /* *
271- * Get the value associated with the given JSON pointer.
269+ * Get the value associated with the given key.
270+ *
271+ * The key will be matched against **unescaped** JSON:
272272 *
273273 * dom::parser parser;
274- * element doc = parser.parse(R"({ "foo": { "a": [ 10, 20, 30 ] }})");
275- * doc["/foo/a/1"] == 20
276- * doc["/"]["foo"]["a"].at(1) == 20
277- * doc[""]["foo"]["a"].at(1) == 20
274+ * parser.parse(R"({ "a\n": 1 })")["a\n"].get<uint64_t>().value == 1
275+ * parser.parse(R"({ "a\n": 1 })")["a\\n"].get<uint64_t>().error == NO_SUCH_FIELD
278276 *
279- * @return The value associated with the given JSON pointer, or:
280- * - NO_SUCH_FIELD if a field does not exist in an object
281- * - INDEX_OUT_OF_BOUNDS if an array index is larger than an array length
282- * - INCORRECT_TYPE if a non-integer is used to access an array
283- * - INVALID_JSON_POINTER if the JSON pointer is invalid and cannot be parsed
277+ * @return The value associated with this field, or:
278+ * - NO_SUCH_FIELD if the field does not exist in the object
279+ * - INCORRECT_TYPE if this is not an object
284280 */
285- inline simdjson_result<element> operator [](const char *json_pointer ) const noexcept ;
281+ inline simdjson_result<element> operator [](const char *key ) const noexcept ;
286282
287283 /* *
288284 * Get the value associated with the given JSON pointer.
@@ -390,38 +386,6 @@ class array : protected internal::tape_ref {
390386 */
391387 inline iterator end () const noexcept ;
392388
393- /* *
394- * Get the value associated with the given JSON pointer.
395- *
396- * dom::parser parser;
397- * array a = parser.parse(R"([ { "foo": { "a": [ 10, 20, 30 ] }} ])");
398- * a["0/foo/a/1"] == 20
399- * a["0"]["foo"]["a"].at(1) == 20
400- *
401- * @return The value associated with the given JSON pointer, or:
402- * - NO_SUCH_FIELD if a field does not exist in an object
403- * - INDEX_OUT_OF_BOUNDS if an array index is larger than an array length
404- * - INCORRECT_TYPE if a non-integer is used to access an array
405- * - INVALID_JSON_POINTER if the JSON pointer is invalid and cannot be parsed
406- */
407- inline simdjson_result<element> operator [](const std::string_view &json_pointer) const noexcept ;
408-
409- /* *
410- * Get the value associated with the given JSON pointer.
411- *
412- * dom::parser parser;
413- * array a = parser.parse(R"([ { "foo": { "a": [ 10, 20, 30 ] }} ])");
414- * a["0/foo/a/1"] == 20
415- * a["0"]["foo"]["a"].at(1) == 20
416- *
417- * @return The value associated with the given JSON pointer, or:
418- * - NO_SUCH_FIELD if a field does not exist in an object
419- * - INDEX_OUT_OF_BOUNDS if an array index is larger than an array length
420- * - INCORRECT_TYPE if a non-integer is used to access an array
421- * - INVALID_JSON_POINTER if the JSON pointer is invalid and cannot be parsed
422- */
423- inline simdjson_result<element> operator [](const char *json_pointer) const noexcept ;
424-
425389 /* *
426390 * Get the value associated with the given JSON pointer.
427391 *
@@ -511,36 +475,34 @@ class object : protected internal::tape_ref {
511475 inline iterator end () const noexcept ;
512476
513477 /* *
514- * Get the value associated with the given JSON pointer.
478+ * Get the value associated with the given key.
479+ *
480+ * The key will be matched against **unescaped** JSON:
515481 *
516482 * dom::parser parser;
517- * object obj = parser.parse(R"({ "foo": { "a": [ 10, 20, 30 ] }})");
518- * obj["foo/a/1"] == 20
519- * obj["foo"]["a"].at(1) == 20
483+ * parser.parse(R"({ "a\n": 1 })")["a\n"].get<uint64_t>().value == 1
484+ * parser.parse(R"({ "a\n": 1 })")["a\\n"].get<uint64_t>().error == NO_SUCH_FIELD
520485 *
521- * @return The value associated with the given JSON pointer, or:
522- * - NO_SUCH_FIELD if a field does not exist in an object
523- * - INDEX_OUT_OF_BOUNDS if an array index is larger than an array length
524- * - INCORRECT_TYPE if a non-integer is used to access an array
525- * - INVALID_JSON_POINTER if the JSON pointer is invalid and cannot be parsed
486+ * @return The value associated with this field, or:
487+ * - NO_SUCH_FIELD if the field does not exist in the object
488+ * - INCORRECT_TYPE if this is not an object
526489 */
527- inline simdjson_result<element> operator [](const std::string_view &json_pointer ) const noexcept ;
490+ inline simdjson_result<element> operator [](const std::string_view &key ) const noexcept ;
528491
529492 /* *
530- * Get the value associated with the given JSON pointer.
493+ * Get the value associated with the given key.
494+ *
495+ * The key will be matched against **unescaped** JSON:
531496 *
532497 * dom::parser parser;
533- * object obj = parser.parse(R"({ "foo": { "a": [ 10, 20, 30 ] }})");
534- * obj["foo/a/1"] == 20
535- * obj["foo"]["a"].at(1) == 20
498+ * parser.parse(R"({ "a\n": 1 })")["a\n"].get<uint64_t>().value == 1
499+ * parser.parse(R"({ "a\n": 1 })")["a\\n"].get<uint64_t>().error == NO_SUCH_FIELD
536500 *
537- * @return The value associated with the given JSON pointer, or:
538- * - NO_SUCH_FIELD if a field does not exist in an object
539- * - INDEX_OUT_OF_BOUNDS if an array index is larger than an array length
540- * - INCORRECT_TYPE if a non-integer is used to access an array
541- * - INVALID_JSON_POINTER if the JSON pointer is invalid and cannot be parsed
501+ * @return The value associated with this field, or:
502+ * - NO_SUCH_FIELD if the field does not exist in the object
503+ * - INCORRECT_TYPE if this is not an object
542504 */
543- inline simdjson_result<element> operator [](const char *json_pointer ) const noexcept ;
505+ inline simdjson_result<element> operator [](const char *key ) const noexcept ;
544506
545507 /* *
546508 * Get the value associated with the given JSON pointer.
@@ -1467,8 +1429,8 @@ struct simdjson_result<dom::element> : public internal::simdjson_result_base<dom
14671429 template <typename T>
14681430 inline simdjson_result<T> get () const noexcept ;
14691431
1470- inline simdjson_result<dom::element> operator [](const std::string_view &json_pointer ) const noexcept ;
1471- inline simdjson_result<dom::element> operator [](const char *json_pointer ) const noexcept ;
1432+ inline simdjson_result<dom::element> operator [](const std::string_view &key ) const noexcept ;
1433+ inline simdjson_result<dom::element> operator [](const char *key ) const noexcept ;
14721434 inline simdjson_result<dom::element> at (const std::string_view &json_pointer) const noexcept ;
14731435 inline simdjson_result<dom::element> at (size_t index) const noexcept ;
14741436 inline simdjson_result<dom::element> at_key (const std::string_view &key) const noexcept ;
@@ -1494,8 +1456,6 @@ struct simdjson_result<dom::array> : public internal::simdjson_result_base<dom::
14941456 really_inline simdjson_result (dom::array value) noexcept ;
14951457 really_inline simdjson_result (error_code error) noexcept ;
14961458
1497- inline simdjson_result<dom::element> operator [](const std::string_view &json_pointer) const noexcept ;
1498- inline simdjson_result<dom::element> operator [](const char *json_pointer) const noexcept ;
14991459 inline simdjson_result<dom::element> at (const std::string_view &json_pointer) const noexcept ;
15001460 inline simdjson_result<dom::element> at (size_t index) const noexcept ;
15011461
@@ -1513,8 +1473,8 @@ struct simdjson_result<dom::object> : public internal::simdjson_result_base<dom:
15131473 really_inline simdjson_result (dom::object value) noexcept ;
15141474 really_inline simdjson_result (error_code error) noexcept ;
15151475
1516- inline simdjson_result<dom::element> operator [](const std::string_view &json_pointer ) const noexcept ;
1517- inline simdjson_result<dom::element> operator [](const char *json_pointer ) const noexcept ;
1476+ inline simdjson_result<dom::element> operator [](const std::string_view &key ) const noexcept ;
1477+ inline simdjson_result<dom::element> operator [](const char *key ) const noexcept ;
15181478 inline simdjson_result<dom::element> at (const std::string_view &json_pointer) const noexcept ;
15191479 inline simdjson_result<dom::element> at_key (const std::string_view &key) const noexcept ;
15201480 inline simdjson_result<dom::element> at_key_case_insensitive (const std::string_view &key) const noexcept ;
0 commit comments