Options for YAJLINTO to handle a null array
Greg Wilburn <gwilburn-kuYYJ3CQfvZxq3Q2jbZZw/[email protected]> Mon, 23 Feb 2026 22:00:11 +0000
| Newsgroups | gmane.comp.lang.as400.rpg |
|---|---|
| Message-ID | <PH0PR17MB4863A5FD70B2064FAD59CC1FDA77A@PH0PR17MB4863.namprd17.prod.outlook.com> |
A web service is returning on of 3 responses... all with HTTP 200. So I'm trying to build a DS and YAJL options to handle at the first two below.
I'm getting the feeling it doesn't like the "errors" being null when it can be an array. Any way around this?
A Success Response
{
"data": {
"shipmentCreate": {
"errors": null,
"shipment": {
"id": "U2hpcG1lbnQtNDA=",
"dispatchedAt": "2026-02-23T13:33:53-08:00",
"trackingNumber": "1ZX565650311617054",
"shippedItems": [
{
"lineItem": {
"id": "TGluZUl0ZW0tMjY5",
"quantity": 2
}
},
{
"lineItem": {
"id": "TGluZUl0ZW0tMjcw",
"quantity": 2
}
}
]
}
}
}
}
An a "successful" response containing an error
{
"data": {
"shipmentCreate": {
"errors": [
{
"field": "",
"messages": [
"Dispatched at is before shipped items were ordered"
]
}
],
"shipment": null
}
}
}
And finally a generic error response (that still returns HTTP 200)
A plain error response:
{
"errors": [
{
"message": "Invalid input: \"SW52b2ljZS0xMDE4MA==\"",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"shipmentCreate"
]
}
],
"data": {
"shipmentCreate": null
}
}
[Logo]<https://www.totalbizfulfillment.com/> Greg Wilburn
Director of IT
301.895.3792 ext. 1231
301.895.3895 direct
gwilburn-kuYYJ3CQfvZxq3Q2jbZZw/[email protected]<mailto:gwilburn-kuYYJ3CQfvZxq3Q2jbZZw/[email protected]>
1 Corporate Dr
Grantsville, MD 21536
www.totalbizfulfillment.com<http://www.totalbizfulfillment.com>
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support-FMtJrHiV//lnDLsaKlm4mFaTQe2KTcn/@public.gmane.org for any subscription related questions.