Hi,
I wanted to create a simple JSON clob like -
{
"attribute1": "value1",
"attribute2": "value2",
"attribute3": "value3"
}
I am using PLSQLAP_Document_API
to create this type of data. But the problem is, during initialization of the PLSQLAP Document, I have to give a name. And that name becomes a parent attribute for rest of my attributes and the output is like -
{
"MAIN_DOC": {
"attribute1": "value1",
"attribute2": "value2",
"attribute3": "value3"
}
}
I can’t get rid of this “MAIN_DOC”
attribute. Is there something I am doing wrong?
Below is my snippet -
DECLARE
json_doc_ PLSQLAP_Document_API.Document :=
PLSQLAP_Document_API.New_Document('MAIN_DOC');
json_ CLOB;
BEGIN
PLSQLAP_Document_API.Add_Attribute(json_doc_, 'attribute1', "value1");
PLSQLAP_Document_API.Add_Attribute(json_doc_, 'attribute2', "value2");
PLSQLAP_Document_API.Add_Attribute(json_doc_, 'attribute3', "value3");
PLSQLAP_Document_API.To_Json(json_ => json_,
main_ => json_doc_);
END;
Thanks in advance,
Rohit.