Re:Antirez' tiny JSON selector library
by cryptonector on Tuesday November 28, 2023 @01:50AM
(#38443126)
jq has a very simple `jv_getpath()` that is a smaller "language" still (the "language" being an array of string and integer indices). I believe Jansson and others also have similar get-path functionality. They don't have the asterisk feature that this has (which is not like .[] in jq), and which looks admittedly quite useful (in terms of ease of use but also in terms of heap allocation avoidance). OTOH this doesn't allow access to non-ident-like object fields except via the asterisk feature. Neat!
[ Parent
| on HN ]
> They don't have the asterisk feature that this has
In jq I believe you can get the asterisk behaviour with ‘map(...)’, but using significantly more characters.
Re:Antirez' tiny JSON selector library
by cryptonector on Wednesday November 29, 2023 @12:31AM
(#38455918)
In jq you'd just write `.[$name]` and let something else bind `$name`. But I was talking about the C bits of jq.