1. Nasir Khan
  2. PowerBuilder
  3. Sunday, 24 May 2020 10:17 AM UTC

Hi All,
Can someone please show me how I would generate JSON in the below format?
I'm not sure on how to create the "shipments" array of objects

Thanks,
Nas

 

{
"shipments":[
{
"shipment_reference":"XYZ-001-01",
"customer_reference_1":"Order 001",
"customer_reference_2":"SKU-1, SKU-2, SKU-3",
"email_tracking_enabled":true,
"from":{
"name":"John Citizen",
"lines": [
"1 Main Street"
],
"suburb": "MELBOURNE",
"state": "VIC",
"postcode": "3000",
"phone": "0401234567",
"email":"john.citizen@citizen.com"
},
"to":{
"name":"Jane Smith",
"business_name":"Smith Pty Ltd",
"lines":[
"123 Centre Road"
],
"suburb":"Sydney",
"state":"NSW",
"postcode":"2000",
"phone":"0412345678",
"email":"jane.smith@smith.com"
},
}
]
}

Nasir Khan Accepted Answer Pending Moderation
  1. Monday, 25 May 2020 22:39 PM UTC
  2. PowerBuilder
  3. # 1

Marco, Thank you.. You pointed me in the right direction!

I'm off and running now! laughing

 

Regards,
Nas

Comment
There are no comments made yet.
Marco Meoni Accepted Answer Pending Moderation
  1. Monday, 25 May 2020 10:15 AM UTC
  2. PowerBuilder
  3. # 2

Hi Nasir,

your "shipments" is an array, therefore use AddItemArray API for JSONGenerator:

https://docs.appeon.com/appeon_online_help/pb2019r2/powerscript_reference/ch10s09.html

Have a look at the two examples from the link above to see how to create the array and, in turn, add inner objects.

Best,

.m

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.