1. JOSE WILLIAM ROMERO OLIVOS
  2. PowerBuilder
  3. Monday, 15 January 2024 00:22 AM UTC

Best regard I need to create the following result with JsonGenerator:

"servicios": {
"procedimientos": [
{
"codPrestador": "500000000001",
"fechalnicioAtencion": "2021-08-18 08:10"
}
]
}
this is my code:

ll_Subitem_Object = lnv_JsonGenerator.additemobject(ll_Item_Array,"servicios")
ll_Subitem_Array=lnv_JsonGenerator.additemarray(ll_Subitem_Object,"procedimientos")

lnv_JsonGenerator.AddItemString(ll_Subitem_Array,"codPrestador","500000000001")
lnv_JsonGenerator.AddItemString(ll_Subitem_Array,"fechalnicioAtencion","2021-08-19 05:00")
However, my result is this:
            "servicios": {
                "procedimientos": [
                ]
            }
 

I get empty and I can't insert values ​​into the object array. What will I be doing wrong? I appreciate the help

JOSE WILLIAM ROMERO OLIVOS Accepted Answer Pending Moderation
  1. Monday, 15 January 2024 12:10 PM UTC
  2. PowerBuilder
  3. # 1
Thank you very much for the reply. Problem solved
Comment
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Monday, 15 January 2024 06:33 AM UTC
  2. PowerBuilder
  3. # 2

Insert a json object to the array and put the string items into this object:

ll_Subitem_Object = lnv_JsonGenerator.additemobject(ll_Item_Array,"servicios")
ll_Subitem_Array=lnv_JsonGenerator.additemarray(ll_Subitem_Object,"procedimientos")

ll_Subitem_Object2 = lnv_JsonGenerator.additemobject(ll_Subitem_Array)
lnv_JsonGenerator.AddItemString(ll_Subitem_Object2,"codPrestador","500000000001")
lnv_JsonGenerator.AddItemString(ll_Subitem_Object2,"fechalnicioAtencion","2021-08-19 05:00")
Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.