tidwall / gjson

Get JSON values quickly - JSON parser for Go
MIT License
14.1k stars 846 forks source link

[question] PR for extracting keys of Result object #220

Closed felipevolpone closed 3 years ago

felipevolpone commented 3 years ago

Hi @tidwall , first of all ty for this lib :)

I wonder if the project is open to add a new method on the gjson.Result to list the keys of that path.

I've seen in #126 that users can write their own code to do that, but I think it would be useful to have something like:

const json = `{"name":{"first":"Janet","last":"Prichard"},"age":47}`
gjson.Get(json, "name").Keys() // returns ["first", "last"]

Rather than just submitting a PR with the feature implementation, I would like to know what u think.

tidwall commented 3 years ago

Sure. I'm cool with you making a PR for this feature.