JSONPath library that supports returning the real path to nodes as well as their values?
from davenull@programming.dev to rust@programming.dev on 25 Oct 2023 15:31
https://programming.dev/post/4908506

Hey everyone, first time poster, long time lurker.

I’ve been crawling crates.io trying to find an existing crate that supports using JSONPath to query a document and returns both the selected node, and the actual path to said node.

For example, say I have the following JSON object:

{ 
  "foo": { 
    "bar": { 
      "baz": "hello!" 
    } 
  }
}

And I query it with $.foo.*.baz, it would return something like:

{ 
 node: "hello!", // Would be something like serde::Value
 path: "$.foo.bar.baz"
}

Does anything like this exist (or is in development) in the rust eco-system today?

Any help would be most appreciated, thank you!

#rust

threaded - newest

davenull@programming.dev on 05 Nov 2023 12:37 collapse

UPDATE: This feature now exists in the jsonpath-rust crate 🎉