Hi all,
Is there any way i can build an XML structure on SAP PI 7.5 and then convert it to JSON (using REST adapter) to generate this:
{
"Headers":[
"ID",
"City",
"Country"
],
"Lines":[
[
12345,
"NEWYORK",
"USA"
],
[
12346,
"TORONTO",
"CANADA"
],
[
12347,
"WASHINGTON",
"USA"
]
]
}
this is the template of previous structure:
{
"Headers":[
"FieldName1",
"FieldName2",
"FieldName3"
],
"Lines":[
[
FieldName1-Value1,
FieldName2-"Value1",
FieldName3-"Value1",
],
[
FieldName1-Value2,
FieldName2-"Value2",
FieldName3-"Value2",
],
[
FieldName1-Value3,
FieldName2-"Value3",
FieldName3-"Value3",
]
]
}
The problem is with the "Lines" structure. There is an array inside the array "Lines" but it has no name on it.
I was thinking to use JAVA mapping to generate it, but i prefer to use a standard way.
Thanks in advance.
Request clarification before answering.
I did it using java mapping to convert XML into JSON (on mapping) and remove the check to convert from XML to JSON in communication channel receiver.
The solution proposed by Manoj K works, but our PI environment is not updated to SP007.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.