i am trying to query like below,
OPT_VAR JSONB;
select
json_build_object('CustomerProfile',t) into OPT_VAR
from
(
select firstName,LastName,Type,Gender
from TABLE_NAME
)t;
My expected output like
{
"CustomerProfile": {
"firstName": "Sam",
"LastName": "Smith",
"Type": "A1",
"Gender": "Male"
}
}
But i am getting something like,
{
"CustomerProfile": {
"firstName": "Sam",
"Gender": "Male",
"LastName": "Smith",
"Type": "A1"
}
}
My only concern is order of the json property.
jsoninstead ofjsonb