I'm trying to gather information around the "array notation" (for a lack of a better name) that's used to "select"/"target" keys in a JSON blob.
I'm specifically talking about the '{a, b, c}' notation that you can use with the #> operator.
The Postgres documentation gives a couple of usage examples, such as:
'{"a": {"b":{"c": "foo"}}}'::json#>'{a,b}' // {"c": "foo"}
or
'{"a": {"b": [1, 2]}}'::json#>'{a,b,1}' // 2
But nothing beyond these very basic examples. I couldn't even find a proper name for this API.
Here are my questions:
- Do you know any proper documentation on the subject
- If not, do you know any features of that API that go beyond the two very simple examples mentioned above? (Meaning: selecting deep keys & selecting an array index) Can it be of any different shape?
We're trying to evaluate whether we can safely parse a string of shape "{a, b, c}" to an array of ["a", "b", "c"] that we could send to our Postgres driver.
Thanks for taking the time to answer me. Cheers!