all.
I have a query in a ExecuteSQLRecord
processor which produces a JSON column in the result:
SELECT t.id, json_agg(json_build_object("value1", t.column1, "value2", t.column2)) AS "test" FROM table t GROUP BY t.id
The processor uses a JSONRecordSetWriter
to write the results. However, the processor returns a String from the database, which causes issues in further processing that expects a JSON value:
{
...
"test": "[{\"value1\": \"column1value\", \"value2\": \"column2value\"}, ...]"
}
Is there a way of turning it to a proper JSON value, i.e., in this format:
{
...
"test": [{"value1": "column1value", "value2": "column2value"}, ...]
}
without resorting to ReplaceText
processors?
I have tried to replace the quotes in the SQL query, to use jsonb_agg()
and jsonb_build_object()
, and to use a QueryDatabaseTableRecord
but none worked.
Thanks in advance.