Skip to content

Handling JSON where root element is an array #6

@JoshuaHintze

Description

@JoshuaHintze

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions