Json conversion in XSLT 1.0

BGAZ 21 Reputation points
2021-06-20T20:28:26.627+00:00

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.

Microsoft BizTalk Server
Microsoft BizTalk Server
A family of Microsoft server products that support large-scale implementation management of enterprise application integration processes.
344 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Leo Erlandsson 1,656 Reputation points
    2021-06-21T06:57:19.747+00:00

    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

    0 comments No comments