on 06-08-2016 6:55 AM
Hi all
In one of my transaction I receive a JSON input like the example below:
{
"scenario": 1,
"matFrom": "aa",
"matTo": "bb",
"batchFrom": "a1",
"batchTo": "b1",
"quantityTo": "0.08",
"pallets":[
"11",
"22",
"33"
]
}
I use the JSON to XML converter action block to generate the XML, but my 'pallets' array disappears!
I would expect my array to be converted to an XML list of element tags?!
<?xml version="1.0" encoding="UTF-8"?><root>
<scenario>1</scenario>
<matFrom>aa</matFrom>
<matTo>bb</matTo>
<batchFrom>a1</batchFrom>
<batchTo>b1</batchTo>
<quantityTo>0.08</quantityTo>
<pallets/>
</root>
If I change my JSON array to an array with objects like this:
{
...
"pallets": [
{
"nr": "11"
},
{
"nr": "22"
},
{
"nr": "33"
}
]
}
Then this will convert to an XML list of elements like this:
<?xml version="1.0" encoding="UTF-8"?><root>
<scenario>1</scenario>
<matFrom>aa</matFrom>
<matTo>bb</matTo>
<batchFrom>a1</batchFrom>
<batchTo>b1</batchTo>
<quantityTo>0.08</quantityTo>
<pallets>
<element>
<nr>11</nr>
</element>
<element>
<nr>22</nr>
</element>
<element>
<nr>33</nr>
</element>
</pallets>
</root>
Is this a bug or is this normal behaviour?
I'm running this on SAP MII v.15.0 SP2 Patch 4.
Hi Glen,
It works correctly with MII15.1 SP2 Patch 1; with your original input JSON i get this output:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<scenario>1</scenario>
<matFrom>aa</matFrom>
<matTo>bb</matTo>
<batchFrom>a1</batchFrom>
<batchTo>b1</batchTo>
<quantityTo>0.08</quantityTo>
<pallets>11</pallets>
<pallets>22</pallets>
<pallets>33</pallets>
</root>
Edit: I missed the last line of your post about MII version. However, I tested this with MII 15.0 SP5 Patch 6 and got the SAME incorrect result that you got. So it has been fixed somewhere between the two versions. I won't be able to upgrade to the latest MII15.0 for a few days yet so I would suggest you log a ticket and support will probably advise which SP and patch corrects this issue.
Regards, Steve
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Glen,
Try using your json as:
{
"scenario": 1,
"matFrom": "aa",
"matTo": "bb",
"batchFrom": "a1",
"batchTo": "b1",
"quantityTo": "0.08",
"pallets":
{
"nr": "11" ,
"nr": "22" ,
"nr": "33"
}
}
And execute with json to xml converter. Hope this would get you the expected result.
Best regards,
Snehal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Glen,
It may not be considered as a bug as the array you are passing is not exactly a json and hence the drill down went till object node i.e. pallets. Though it may work in recent versions, it would be a perfect solution if you can mask it into a proper json or array of json.
It would work that way.
Your json should look like:
{
"scenario": 1,
"matFrom": "aa",
"matTo": "bb",
"batchFrom": "a1",
"batchTo": "b1",
"quantityTo": "0.08",
"pallets": [{
"a": "11"
}, {
"a": "22"
}, {
"a": "33"
}]
}
Best Regards,
Swaroop
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
6 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.