simdjson: JSONPointer does not follow RFC6901 it follows the Relative JSON Pointers specification (documentation bug)

Your support of JSONPointer ( RFC6901 ) seems to be in error.

The RFC specifically states the search string must begin with ‘/’. There’s a reason: the empty string (“”) refers to the entire document, the string “/” refers to a field with name “” in the root of the document. This is all covered in the RFC.

This code succeeds and should fail:

	string test_str("{\"id\": 100}");
	try {
		simdjson::dom::parser test_parser;
		simdjson::dom::element test_element = test_parser.parse(test_str);
		 cout << test_element.at("id") << endl;
	}

This code fails and should succeed:

	string test_str("{\"id\": 100}");
	try {
		simdjson::dom::parser test_parser;
		simdjson::dom::element test_element = test_parser.parse(test_str);
		 cout << test_element.at("/id") << endl;
	}

I know you might have trouble changing the API at this point, but if you could have a note if your non-standard implementation, and/or a function which is compliant, that would be super cool.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 23 (19 by maintainers)

Most upvoted comments

We follow the specification. Please have a look at RFC6901. By the specification ‘/’ needs to be encoded as ‘~1’.