On 12/03/2012 08:14 PM, Josh Berkus wrote:
> Andrew,
>
> What about doing:
>
> json_get(json, json)
> returns json
>
> where parameter #2 is a path expressed as JSON? For example,
>
> json_get(personal_profile, '[ {contact_info {phone numbers {cell phones}
> } } ]')
> ... would return whatever was in that heirarchical object, in this case
> an array of cell phone numbers.
>
> Or am I just reinventing jsonpath?
>
Yes, you are, rather. It might be possible to do something like:
json_get(json, variadic text) => json
as long as it doesn't involve any testing beyond field name / array
index equivalence.
cheers
andrew