on 05-25-2015 2:14 PM
Hi Experts
i want to do one small conversion using XSLT mapping,
here is input data :
{"ns0:MT_Source":{ "field1": null, "field2": "ec92a1e9-cef0-48aa-8800-a2e500ce8b1c", "field3": null, "Subnode": [ { "field4": 80, "field5":"Kilograms", "field6": null, "field7": "12345678-0003-0000-0000-000000000012", "field8": null, "field9": "DFF5JGJ3N5", "WasteStreamCodes": "200301"
},{} ]}}
and expected output data :
{ "field1": null, "field2": "ec92a1e9-cef0-48aa-8800-a2e500ce8b1c", "field3": null, "Subnode": [ { "field4": 80, "field5": "Kilograms",
"field6": null, "field7": "12345678-0003-0000-0000-000000000012", "field8": null, "field9": ["DFF5JGJ3N5"], "WasteStreamCodes": ["200301"]
} ]}
in above output data below things has been done:
1:deleted - {"ns0:MT_Source":
2:added- Square brackets"[]" for DFF5JGJ3N5 and 200301(these two values always comes different values)
3:deleted - ,{} at 3rd line
can any one please help me the XSLT code?
Thanks in Advance!!
Thanks & Regards,
Maheswarareddy
Hi all,
If i'm not wrong you have a JSON format and XSLT doesn't support it.
Also to use the function provided by Azhar you will
need to use XSLT 2.0, you will need a PI 7.31 SP10 or 7.4 SP05 (Use Custom XSLT Transformer to Support XSLT 2.0 in XLST Mappings (New) - What's New in SAP NetWeaver...)
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Both,
I was expecting the code for that , but thanks for coming back on my post
Yes Inaki, you are right ..i am trying to change little json formate as per my requirement..
since i am not able to write XSLT code..i had to go for java mapping to achieve the same.
but here also i am facing some exception..below is the post which i raised another for that..pls have a look.
http://scn.sap.com/thread/3747566
Thanks & Regards,
Maheswarareddy
Hi,
You can achieve this using translate function in XSLT.
eg:
fn:translate(string1,string2,string3) --> Converts string1 by replacing the characters in string2 with the characters in string3
Refer:
XPath, XQuery, and XSLT Function Reference
Regards,
Azhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
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.