Hello,
I have a JSON message where a variable could alternatively contains a value or a Json string itself.
This is the RPGLE Data structure to MAP json data.
image.png
In the example below everything works fine because "name" and "value" are properly mapped into the RPGLE data structure
image.png
In this example below "value" contains a Json string itself named "daterange".
There ia an extra level and I would like to parse "value" as a standard rpgle variable.
I will then scan "value" variable for "{daterange:" value and from there extract "endDate" and "startDate" via a new RPGLE structure.
image.png
I would like to know if this is possibile via YAJLINTO parser.
JSON FIRST EXAMPLE
{
"username": "ADMIN",
"companycode": "MVS",
"cmdid": 10000,
"lang": "it",
"filtersvalue": [
{
"name": "cmd_from",
"value": 1
},
{
"name": "cmd_to",
"value": 999999
}
]
}
JSON SECOND EXAMPLE
{
"username": "ADMIN",
"companycode": "MVS",
"cmdid": 70050,
"lang": "it",
"filtersvalue": [
{
"name": "period",
"value": {
"dataRange": {
"startDate": "Fri Dec 01 2023 00:00:00 GMT+0100 (Central European Standard Time)",
"endDate": "Tue Jan 02 2024 00:00:00 GMT+0100 (Central European Standard Time)"
}
}
}
]
}
Thank you,
Giovanni
I have a JSON message where a variable could alternatively contains a value or a Json string itself.
This is the RPGLE Data structure to MAP json data.
image.png
In the example below everything works fine because "name" and "value" are properly mapped into the RPGLE data structure
image.png
In this example below "value" contains a Json string itself named "daterange".
There ia an extra level and I would like to parse "value" as a standard rpgle variable.
I will then scan "value" variable for "{daterange:" value and from there extract "endDate" and "startDate" via a new RPGLE structure.
image.png
I would like to know if this is possibile via YAJLINTO parser.
JSON FIRST EXAMPLE
{
"username": "ADMIN",
"companycode": "MVS",
"cmdid": 10000,
"lang": "it",
"filtersvalue": [
{
"name": "cmd_from",
"value": 1
},
{
"name": "cmd_to",
"value": 999999
}
]
}
JSON SECOND EXAMPLE
{
"username": "ADMIN",
"companycode": "MVS",
"cmdid": 70050,
"lang": "it",
"filtersvalue": [
{
"name": "period",
"value": {
"dataRange": {
"startDate": "Fri Dec 01 2023 00:00:00 GMT+0100 (Central European Standard Time)",
"endDate": "Tue Jan 02 2024 00:00:00 GMT+0100 (Central European Standard Time)"
}
}
}
]
}
Thank you,
Giovanni
Comment