question

BGAZ-3650 avatar image
0 Votes"
BGAZ-3650 asked LeoErlandsson answered

Json conversion in XSLT 1.0

Within XSLT in Biztalk, I have a requirement to convert to json for a specific data only within my xml. Am NOT looking at converting my entire xml to Json, just data from a specific node. Below is a an example of that specific node.

INPUT FILE
<ns0:A>
<ns0:A1>
<ns0:A11 name="XYZ">Node01</ns0:A11>
<ns0:A11 name="ABC">Node02</ns0:A11>
<ns0:A11 name="BCD">Node03</ns0:A11>
</ns0:A1>
</ns0:A>


EXPECTED OUTPUT
<def>
<defdata>{"XYZ":"Node01", "ABC":"Node02", "BCD":"Node03"}</defdata>
</def>

Any thoughts or code block would be helpful.

biztalk-server
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

LeoErlandsson avatar image
0 Votes"
LeoErlandsson answered

Hi,

You have several options. Either, you can call custom code (.NET) to encode to JSON. Then set it in the XML (using Map or Orchestration)
Or, you can create a schema in BizTalk and call an Encode JSON Pipeline inline (using Map or Orchestration).

Br,
Leo

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.