Closed manmohantarle closed 11 months ago
You can achieve that with multipaths (see https://github.com/tidwall/gjson/blob/master/SYNTAX.md#multipaths ):
#.{name,children}
On Thu, Dec 21, 2023, 18:34 Manmohan Tarle @.***> wrote:
I want to get values for some keys from an array of objects and resulting value should also be array of objects with specified keys,
as per given below, source
[ { "name": "tom", "age":37, "children": ["Sara","Alex","Jack"], "fav.movie": "Deer Hunter" }, { "name": "riddle", "age":45, "children": ["Json","James","Jill"], "fav.movie": "Saw" } ]
target json
[ { "name": "tom", "children": ["Sara","Alex","Jack"] }, { "name": "riddle", "children": ["Json","James","Jill"] } ]
how can I achieve this?
— Reply to this email directly, view it on GitHub https://github.com/tidwall/gjson/issues/343, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABURVOKFH7OVPNTWMPXDEGLYKRXKVAVCNFSM6AAAAABA6XNXWKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA2TEOBSGQZDQMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>
that worked, thank you @volans-
Hello @tidwall
I want to get values for some keys from an array of objects and resulting value should also be array of objects with specified keys,
as per given below, source
target json
how can I achieve this?