🌐
json-everything
blog.json-everything.net › posts › paths-and-pointers
JSON Path vs JSON Pointer | json-everything
June 20, 2024 - JSON Path and JSON Pointer are two different syntaxes that serve two different purposes. JSON Path is a query syntax that’s used to search JSON data for values that meet specified criteria. JSON Pointer is an indicator syntax that’s used to specify a single location within JSON data.
🌐
GitHub
github.com › yalp › jsonpath › issues › 1
How does jsonpath compare to jsonpointer ? · Issue #1 · yalp/jsonpath
September 1, 2015 - Salut Marc! Good to see you're writing some Go! I'm curious, how does jsonpath compare to jsonpointer ? http://tools.ietf.org/html/draft-pbryan-zyp-json-pointer-02 Seems much more powerful, but not very popular. A+ Antoine
Author   ant0ine
Discussions

GSON | Extract JSON's Root Name | JsonPath Or JsonPointer - Stack Overflow
Gson does not natively support JSONPath or JSON Pointer. More on stackoverflow.com
🌐 stackoverflow.com
JavaScript Object Notation (JSON) Pointer (2013)
What could possibly go wrong · It looks like that kind of escaping is just not supported at all in JSON Pointer. I kind of want to say that once you've noticed NUL is a problem enough to call it out the document, you should probably just ban it and pop in an escape to represent it More on news.ycombinator.com
🌐 news.ycombinator.com
11
17
April 13, 2023
syntax - json query and json path - Stack Overflow
Further, it doesn't say what jq stands for either. So let me assume it stands for "json query". So the next question is, of all json query tool listed in jsonquerytool.com, (i.e., JSONPath, JSPath, Lodash, Underscore, JPath, XPath for JSON, JSON Pointer and just plain old JavaScript), More on stackoverflow.com
🌐 stackoverflow.com
Wouldn't JSONPatch, JSONPointer be better in Foundation? - Swift-DocC - Swift Forums
Upon looking for third party library for the IETF standards for JSONPatch and JSONPointer I stumbled across DocC having those capabilities. Sources/SwiftDocC/Model/Rendering/Variants/ JSONPatchApplier.swift JSONPatchO… More on forums.swift.org
🌐 forums.swift.org
1
September 4, 2023
🌐
Gregsdennis
gregsdennis.github.io › Manatee.Json › usage › pointer.html
JSON Pointer
It also exposes Evaluate(JsonValue). This method returns a result object that exposes either the value found at the path or an error describing where the path ended. To create a path, you can either write out the path in a string and parse it using the JsonPointer.Parse() method: ... Both of these create the same path. ... This will return a PointerEvaluationResults object with results.Value equal to the JSON value 0.
🌐
Medium
nazeel-ak.medium.com › working-with-json-data-3b863b90dff0
Working with JSON data. Developers who works daily with JSON… | by Nazeel A K | Medium
November 13, 2021 - RFC recommendation: https://to... ... jsonpointer just defines how to access to a single value inside a json document, whereas jsonpath has more powerful features like union (extract multiple values), filters and deep search (recursively match a path)....
🌐
Google Groups
groups.google.com › g › json-schema › c › cFdEdDkStH0
JSON pointer
JSON Path cannot. BTW, JSON Pointer uses ^ to escape itself and /, so addressing property "/store/book[1]/title" leads to a reference token of "^/store^/book[1]^/title" in the JSON pointer.
🌐
Hacker News
news.ycombinator.com › item
JavaScript Object Notation (JSON) Pointer (2013) | Hacker News
April 13, 2023 - What could possibly go wrong · It looks like that kind of escaping is just not supported at all in JSON Pointer. I kind of want to say that once you've noticed NUL is a problem enough to call it out the document, you should probably just ban it and pop in an escape to represent it
🌐
Trickster Dev
trickster.dev › post › easier-json-wrangling-with-jq-jsonpath-and-jsonpointer
Easier JSON wrangling with jq, JSONPath and JSONPointer – Trickster Dev
Since JSONPath standard is still being developed and does not have a proper standard we will not discuss it further. However, I would advice to keep it in mind for future use when it is more established. JSONPointer, described in RFC6901 is a rather simple a way to query JSON documents, similar to very limited subset of XPath. It is implemented by jsonpointer module that is available from PIP. ... >>> from jsonpointer import resolve_pointer ...
🌐
Tmforum
engage.tmforum.org › discussion › tmf641-v5-json-path-as-an-alternative-to-json-pointer-1
TMF641 v5 - JSON Path as an Alternative to JSON Pointer | Open APIs
Hello everyone,In TMF641 v5, the specification introduces JSONPatch sub-resource and prescribes JSON Pointer as the method for identifying parts of a JSON docum
Find elsewhere
🌐
RFC Editor
rfc-editor.org › rfc › rfc9535.html
RFC 9535: JSONPath: Query Expressions for JSON
JSON [RFC8259] is a popular ... from within a given JSON value.¶ · In relation to JSON Pointer [RFC6901], JSONPath is not intended as a replacement but as a more powerful companion....
🌐
Baeldung
baeldung.com › home › json › overview of json pointer
Overview of JSON Pointer | Baeldung
January 8, 2024 - JSON Pointer (RFC 6901) is a feature from JSON Processing 1.1 API (JSR 374). It defines a String that can be used for accessing values on a JSON document.
🌐
Swift Forums
forums.swift.org › development › swift-docc
Wouldn't JSONPatch, JSONPointer be better in Foundation? - Swift-DocC - Swift Forums
September 4, 2023 - Upon looking for third party library for the IETF standards for JSONPatch and JSONPointer I stumbled across DocC having those capabilities. Sources/SwiftDocC/Model/Rendering/Variants/ JSONPatchApplier.swift JSONPatchO…
Top answer
1 of 3
6

You can do it easily with Hibernate Validator 6.1.5.

You need to provide your own implementation of PropertyNodeNameProvider.

By implementing it, we can define how the name of a property will be resolved during validation. In our case, we want to read the value from the Jackson configuration.

Creating a validator:

 ValidatorFactory validatorFactory = Validation.byProvider( HibernateValidator.class )
        .configure()
        .propertyNodeNameProvider(new JacksonPropertyNodeNameProvider())
        .buildValidatorFactory();

JacksonPropertyNodeNameProvider:

public class JacksonPropertyNodeNameProvider implements PropertyNodeNameProvider {

  private final ObjectMapper objectMapper = new ObjectMapper();

  @Override
  public String getName(Property property) {
    if ( property instanceof JavaBeanProperty ) {
        return getJavaBeanPropertyName( (JavaBeanProperty) property );
    }

    return getDefaultName( property );
  }

  private String getJavaBeanPropertyName(JavaBeanProperty property) {
    JavaType type = objectMapper.constructType( property.getDeclaringClass() );
    BeanDescription desc = objectMapper.getSerializationConfig().introspect( type );

    return desc.findProperties()
            .stream()
            .filter( prop -> prop.getInternalName().equals( property.getName() ) )
            .map( BeanPropertyDefinition::getName )
            .findFirst()
            .orElse( property.getName() );
  }

  private String getDefaultName(Property property) {
    return property.getName();
  }
}

More details You can find in documentation:

2 of 3
0

As far as I understood your question You are seeking path to your field. As there is no I/P JSON I have taken one example for you.

package jsonpath;

import java.util.List;

import com.jayway.jsonpath.Configuration;
import com.jayway.jsonpath.Option;
import static com.jayway.jsonpath.JsonPath.*;

public class GetPaths {
    
    public static void main(String [] args) {
        String json = "{\"top_field\": { \"mid_field\": [ { \"my_field\": true, }, { \"my_field\": true, } ], \"another_mid_field\": [ { \"my_field\": false } ] }}";
        
        Configuration conf = Configuration.builder().options(Option.AS_PATH_LIST).build();
        List<String> pathList = using(conf).parse(json).read("$..my_field");
        for(String path : pathList) {
            System.out.println(path);
        }
    }
}

Will output exactly

$['top_field']['mid_field'][0]['my_field']
$['top_field']['mid_field'][1]['my_field']
$['top_field']['another_mid_field'][0]['my_field']

If you do some simple string replace on that one I think it´s a nice and easy solution. I`m not sure if you can get anything similar with plain Jackson/FasterXML. JsonPath uses Jackson under the hood.

You can get to more about Jayway JsonPath on official git repo

🌐
Hacker News
news.ycombinator.com › item
Interesting that they're using JSONPath, which isn't even specified formally any... | Hacker News
December 3, 2016 - We're working on a new variant of JSONPath that we're hoping to publish as a formal, comprehensive specification. It's essentially a superset of JSONPath with some syntax warts fixed (like the need to start with $). I wrote a little about it on HN a week ago [1]
🌐
npm Trends
npmtrends.com › JSONPath-vs-json-path-vs-json-pointer-vs-json-query-vs-jsonpath-vs-jsonpointer
JSONPath vs json-path vs json-pointer vs json-query vs jsonpath vs jsonpointer | npm trends
Comparing trends for JSONPath 0.11.2 which has 21,459 weekly downloads and 1,089 GitHub stars vs. json-path 0.1.3 which has 14,964 weekly downloads and unknown number of GitHub stars vs. json-pointer 0.6.2 which has 2,209,791 weekly downloads and 182 GitHub stars vs. json-query 2.2.2 which has 258,675 weekly downloads and unknown number of GitHub stars vs. jsonpath 1.1.1 which has 3,366,226 weekly downloads and 1,405 GitHub stars vs. jsonpointer 5.0.1 which has 9,590,460 weekly downloads and 197 GitHub stars.
🌐
json-everything
blog.json-everything.net › posts › paths-and-pointers-correction
Correction: JSON Path vs JSON Pointer | json-everything
June 20, 2024 - JSON Path and JSON Pointer are two different syntaxes that serve two different purposes. JSON Path is a query syntax that’s used to search JSON data for values that meet specified criteria.
🌐
GitHub
github.com › gregsdennis › json-everything › issues › 287
JsonPath to JsonPointer · Issue #287 · json-everything/json-everything
June 16, 2022 - Additional context Since the change in PathMatch.Location from JsonPointer to JsonPath I lost the ability to quickly parse the matched path.
Author   SGStino
🌐
json-everything
blog.json-everything.net › posts › better-json-pointer
Better JSON Pointer | json-everything
June 20, 2024 - For example, let’s combine /foo/bar and /baz. Under the old way, the pointers for those hold the arrays ['foo', 'bar'] and ['baz']. When combining them, I’d just merge the arrays: ['foo', 'bar', 'baz']. It’s allocating a new array, but not new strings.
🌐
ongoing by Tim Bray
tbray.org › ongoing › When › 201x › 2017 › 04 › 14 › JsonPath-Needs-Work
ongoing by Tim Bray · JSONPath - tbray.org
April 14, 2017 - For Kubernetes we have a strong desire to use JSONPath for adhoc referential integrity and loose coupling between resources, but the lack of a formal spec has meant we have been cautious about its use. We would be eager consumers of a formal spec and work to provide a Go library (which we have informally today). ... The Mojolicious web framework implements JSON pointer support: http://mojolicious.org/perldoc/Mojo/JSON/Pointer