You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
If you want to project out a simple structure out of a large JSON you have two options:
a) Formalize the large JSON scheme, parse that, and post-process it
b) Get the parts you need with using paths
However, a) is expensive for the programmer, and b) is quite limited and computationally expensive if you want to get around that
Describe the solution you'd like
let vs = sonic_rs::get(line, sonic_rs::pointer!["aliases", "en", Index, "value"])
and
let o = sonic_rs::get(line, sonic_rs::pointer!["aliases", Key, 0, "value"])
Describe alternatives you've considered
for i in0..MAX_ARRAY_SIZE{match sonic_rs::get(line, sonic_rs::pointer!["aliases", "en", i, "value"]){Ok(r) => { vs.push_back(r)}Err(_) => {break}}}
and
for lang in languages {match sonic_rs::get(line, sonic_rs::pointer!["aliases", lang, 0, "value"]){Ok(r) => { o.insert(lang, r)}Err(_) => {continue}}}
Additional context
Think about it as using a well-typed Glob for your JSON.
Notably, the workaround gets quadratically worse when you have more placeholders in your path.
The text was updated successfully, but these errors were encountered:
Yes, pointer! has limitations when it comes to retrieving multiple keys from a large JSON.
If we want to perform quick and flexible searches on large JSON data as above, it is advisable to support the JSONPath RFC. While it is included in the roadmap, it may not be completed shortly.
Is your feature request related to a problem? Please describe.
If you want to project out a simple structure out of a large JSON you have two options:
a) Formalize the large JSON scheme, parse that, and post-process it
b) Get the parts you need with using paths
However, a) is expensive for the programmer, and b) is quite limited and computationally expensive if you want to get around that
Describe the solution you'd like
let vs = sonic_rs::get(line, sonic_rs::pointer!["aliases", "en", Index, "value"])
and
let o = sonic_rs::get(line, sonic_rs::pointer!["aliases", Key, 0, "value"])
Describe alternatives you've considered
and
Additional context
Think about it as using a well-typed Glob for your JSON.
Notably, the workaround gets quadratically worse when you have more placeholders in your path.
The text was updated successfully, but these errors were encountered: