LANSA Integrator - Json Binding Wizard – Cannot define Array of Objects
Posted: Wed Mar 02, 2022 3:14 am
Hi all,
Based on the json specification we need to build a fragment array in which multiple objects will reside.
See below the example:
"channels": [
{
"viber": {
"message": {
"text": "Viber Message"
},
"validity_period": 120
}
},
{
"sms": {
"from": "TEST",
"text": "SMS Message",
"encoding": 0,
"type": 1,
"validity_period": 240
}
}
]
Upon trying to build the solution, the json server types are built like so, where inside the MobileMessage fragment there is an array of MobileChannels. Inside MobileChannels fragment there are 3 fragments, one for push one for viber and one for sms.
Building the solution based on the json server type described above we have the following.
However, the solution as it is built produces the following (as expected) json and not the one requested by the json specification.
"channels": [
{
"viber": {
"validity_period": 60,
"message": {
"image": "",
"caption": "",
"action": "",
"text": ""
},
"smartphone_only": false,
"action_tracking": true
},
"sms": {
"validity_period": 2880,
"encoding": 0,
"type": 0,
"from": "",
"text": ""
}
}
],
So, inside fragment array “channels” 3 fragments are produced (2 in this case) inside a single entity of the array “channels”.
Is it possible to define somehow an element of type object that will be the repeating entity of the array instead of having fragments?
Currently, I cannot see such possibility in the definitions of json server types.
Am I missing something?
Based on the json specification we need to build a fragment array in which multiple objects will reside.
See below the example:
"channels": [
{
"viber": {
"message": {
"text": "Viber Message"
},
"validity_period": 120
}
},
{
"sms": {
"from": "TEST",
"text": "SMS Message",
"encoding": 0,
"type": 1,
"validity_period": 240
}
}
]
Upon trying to build the solution, the json server types are built like so, where inside the MobileMessage fragment there is an array of MobileChannels. Inside MobileChannels fragment there are 3 fragments, one for push one for viber and one for sms.
Building the solution based on the json server type described above we have the following.
However, the solution as it is built produces the following (as expected) json and not the one requested by the json specification.
"channels": [
{
"viber": {
"validity_period": 60,
"message": {
"image": "",
"caption": "",
"action": "",
"text": ""
},
"smartphone_only": false,
"action_tracking": true
},
"sms": {
"validity_period": 2880,
"encoding": 0,
"type": 0,
"from": "",
"text": ""
}
}
],
So, inside fragment array “channels” 3 fragments are produced (2 in this case) inside a single entity of the array “channels”.
Is it possible to define somehow an element of type object that will be the repeating entity of the array instead of having fragments?
Currently, I cannot see such possibility in the definitions of json server types.
Am I missing something?