Answer the question
In order to leave comments, you need to log in
How to output related table in JSON?
I'm using this API: https://github.com/alixaxel/ArrestDB I'm
using a table query, but it's linked to another table. How to get a json object instead of an external record id?
Now like this:
{
"id": 1,
"name": "Тестовая запись",
"id_tabletest": 1
},
{
"id": 2,
"name": "Тестовая запись",
"id_tabletest": 2
}
{
"id": 1,
"name": "Тестовая запись",
"id_tabletest": {
"id": 1,
"name": "Тестовая запись",
}
},
{
"id": 2,
"name": "Тестовая запись",
"id_tabletest": {
"id": 1,
"name": "Тестовая запись",
}
}
Answer the question
In order to leave comments, you need to log in
Judging by what I saw in this library - no way. More precisely, you can make a call to the view through it, where you can use json_agg ( https://postgrespro.ru/docs/postgrespro/10/functio... ) to convert what you need into json.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question