- Stefan Sievers
- PowerBuilder
- Monday, 15 July 2019 09:27 AM UTC
Hi everyone,
i try to parse a JSON-String with the new functionalitys of PB2019 and get this error message: "Failed to load the JSON data because its root node is not an object"
sample code:
string ls_json, ls_return
JSONPackage luo_json
luo_json = create JSONPackage
ls_json = '[{"datum": "2019-01-01","evu": "BH3452","citId": "a1234567bccc15ad45aa1a6bd73a6cbd","gleis": {"soll": "11","ist": "3a"},"zeit": {"ankunft": {"soll": null,"ist": "11:31:00"},"abfahrt": {"soll": "11:35:00","ist": "11:36:00"}}}]'
ls_return = luo_json.loadString(ls_json)
0 then
messagebox('Abort!', 'Parsing the JSON failed: '+ls_return, StopSign!)
return
end if
When i omit the square brackets it works fine, but this is just example code. Is there any way to get PB to work with an array of JSON-Objects without building the whole loop-around (with JSONParser) by myself?
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.