[-] davenull@programming.dev 1 points 1 year ago

UPDATE: This feature now exists in the jsonpath-rust crate ๐ŸŽ‰

6
submitted 1 year ago* (last edited 1 year ago) by davenull@programming.dev to c/rust@programming.dev

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!

[-] davenull@programming.dev 1 points 1 year ago

YAML is far from perfect but this seems like a hot take. I work with OpenAPI definitions a lot so I'm just curious what you found difficult about maintaining a definition in YAML?

davenull

joined 1 year ago