on 11-13-2015 3:41 AM
Hi All,
I am working on IDoc toJason format in PI7.31 SP15.I am facing issues below.
1.
actual Jason format:
{"data":{"id":"s123","types":11}}
Expected format:
{"data":[{"id":"s123","types":11}]}--How to achieve it?
2.Expected Jason format below in case of multiple records ,i mean data has to repeat for each record.Is it possible?
{"data":[{"id":"s123","types":11}]},{"data":[{"id":"s123","types":11}]},{"data":[{"id":"s123","types":11}]}
Please provide some inputs on above.
Thanks,
Giri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
let me tell how rest adapter will convert xml to json format
if xml comes like
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<id>s123</id>
<types>11</types>
</data>
output would be
{
"data": {
"id": "s123",
"types": "11"
}
}
if xml comes
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<id>s123</id>
<types>11</types>
</data>
<data>
<id>s123</id>
<types>11</types>
</data>
<data>
<id>s123</id>
<types>11</types>
</data>
output would be
{
"data": [
{
"id": "s123",
"types": 11
},
{
"id": "s123",
"types": 11
},
{
"id": "s123",
"types": 11
}
]
}
here you can observe one thing, when node comes multiple times then adapter will add those brackets [ ](in json we can say array)
so if your actual requirement as even after single node comes you need array symbol , you can not achive this , you suppose to go some other option(something like java code)
also one work around i can suggest you, but not sure you have to check with REST server team if that OK with them.
here is the trick!
at target side structure i can see there is a node named as data
this node you can just duplicate in mapping and map with constant
since u node duplicated , you can see fields also under that data node, make sure you should not map anything for those fields.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.