KyselyK
Kysely3y ago
31 replies
bombillazo

Convert JSON array result into JS array

Hello, I am running an SQL query that returns data in this format since it is a PG JSON array:
{
  rows: [
    {
      array_agg: "{cat,dog,horse,camel,tiger}"
    }
  ]
}


How can I convert such an array in PG format to a string array in JS? Or better yet is there any way that kysely can do that already internally?
Was this page helpful?