This is the JSON Data file supplied
"Order ID": "000000034",
"Grand Total": "6",
"Sub Total": "5.45",
"Shipping Method": "flatrate_flatrate",
"Shipping Description": "Order below FIS value - freight to be advised",
"Payment Method": "Bank Transfer Payment",
"Billing Details": {
"City": "Springfield Lakes",
"Street": "Brisbane",
"Post Code": "4064",
"Telephone": "123456789",
"RegionCode": "Queensland"
},
"Shipping Details": {
"Shipping City": "Springfield Lakes",
"Shipping Street": "Brisbane",
"Shipping Post Code": "4064",
"Shipping Telephone": "123456789",
"Shipping RegionCode": "Queensland"
},
"Customer Details": {
"First Name": "Test",
"Last Name": "Maybray",
"Email": "test234@maybray.com",
"IP": "144.130.97.53",
"ID": "412"
},
"Products": [
{
"ID": "",
"Name": "9\" x 7\" CLEAR BOOK COVER WITH COLOURED RETURNS - PACK OF 5 - BC97",
"Type": "simple",
"Qty": "1",
"Price": "1.95"
},
{
"ID": "",
"Name": "SCRAPBOOK COVER - CLEAR - PACK OF 5 - SBC4934",
"Type": "simple",
"Qty": "1",
"Price": "3.5"
}
]
}
My Code snippet below with json as read from file.
What am I doing wrong? How do I access the fields?
My task is to parse the file and create the order in the PxPlus application order file.
OPEN (HFN,ISZ=10240)"/hit/temp/000000034.json"
READ RECORD (LFO,ERR=*NEXT)TEMPJSONORDER$;
LET JSONORDER$+=TEMPJSONORDER$;
GOTO *SAME
!
ESCAPE !
DIM LOAD MORDER${ALL}=JSONORDER$
!
PRINT MORDER$["Order ID"]
! This returns nothing at all
1}? jsonorder$
{"Order ID":"000000034","Grand Total":"6","Sub Total":"5.45","Shipping Method":"
flatrate_flatrate","Shipping Description":"Order below FIS value - freight to be
advised","Payment Method":"Bank Transfer Payment","Billing Details":{"City":"Sp
ringfield Lakes","Street":"Brisbane","Post Code":"4064","Telephone":"123456789",
"RegionCode":"Queensland"},"Shipping Details":{"Shipping City":"Springfield Lake
s","Shipping Street":"Brisbane","Shipping Post Code":"4064","Shipping Telephone"
:"123456789","Shipping RegionCode":"Queensland"},"Customer Details":{"First Name
":"Test","Last Name":"Maybray","Email":"test234@maybray.com","IP":"144.130.97.53
","ID":"412"},"Products":[{"ID":"","Name":"9\" x 7\" CLEAR BOOK COVER WITH COLOU
RED RETURNS - PACK OF 5 - BC97","Type":"simple","Qty":"1","Price":"1.95"},{"ID":
"","Name":"SCRAPBOOK COVER - CLEAR - PACK OF 5 - SBC4934","Type":"simple","Qty":
"1","Price":"3.5"}]}
1}
1}? morder${all}
00000003465.45flatrate_flatrateOrder below FIS value - freight to be advisedBank
Transfer PaymentSpringfield LakesBrisbane4064123456789QueenslandSpringfield Lak
esBrisbane4064123456789QueenslandTestMaybraytest234@maybray.com144.130.97.534129
" x 7" CLEAR BOOK COVER WITH COLOURED RETURNS - PACK OF 5 - BC97simple11.95SCRAP
BOOK COVER - CLEAR - PACK OF 5 - SBC4934simple13.5
1}