Handling JSON where root element is an array
How would you handle the case of format.literal where you are trying to update a jsonb column but where the root element is an array?
For example, most JSON types you would insert would look like this
{
"key": "value"
}
but there are times where you want the root element to be an array such as
[
{
"key": "value"
}
]
However in this library and others i've seen with pg-format seem to always treat Array not as a JSON style object, but rather something to loop over and recursively call.
Do you have any thoughts?
Hi @GimpMaster, can you add a failing test case for your scenario? I can see if I can add a fix then.
Possibly related https://github.com/ScaleLeap/pg-format/issues/5
Sorry, I forgot I commented on this. @jcalfee - your post is almost 2 years old. I forgot how I worked around this. I'll try to remember later to figure out what I did.