The output getting from the query id repeated it the data inside is multiple
select json_arrayagg(json_object("network", basics_profiles.network, "username", basics_profiles.username, "url", basics_profiles.url)) as profiles from basics_profiles;
Ok here when i run this code the in work section even when there it is only 2 data. it get doubled. if there was only single data. then there is no issue.
output while there is more tan 1 data:
[
{
"url": "twitter.com/naruto",
"network": "Twitter",
"username": "uzumakinaruto"
},
{
"url": "twitter.com/naruto",
"network": "Twitter",
"username": "uzumakinaruto"
},
{
"url": "instagram.com/naruto",
"network": "Instagram",
"username": "uzumakinaruto"
},
{
"url": "instagram.com/naruto",
"network": "Instagram",
"username": "uzumakinaruto"
}
]
i wanted something like this
[
{
"url": "twitter.com/naruto",
"network": "Twitter",
"username": "uzumakinaruto"
},
{
"url": "instagram.com/naruto",
"network": "Instagram",
"username": "uzumakinaruto"
}
]
u can try with the thsi table:
create table basics_profiles(network text, url text, username text);
insert into basics_profiles values("twitter","jhaajdka.com","naruto");
insert into basics_profiles values("instagram","jhasdasdasdsdd.com","sasuke");