REST JSON Christmas Puzzle

Posted: December 24, 2015  |  Categories: BizTalk Uncategorized
Tags: JSON

If I use the BizTalk 2013 R2 JSON Encoder pipeline component to convert the following XML

<ns0:ASCIISchema xmlns:ns0="http://RestASCIICharTest.ASCIISchema"><TAB>    </TAB><LF>
</LF><CR>
</CR><SPACE> </SPACE><ExtendedASCII255></ExtendedASCII255></ns0:ASCIISchema>

to JSON I get all null elements

{
"TAB": null,
"LF": null,
"CR": null,
"SPACE": null,
"ExtendedASCII255": null
}

I wanted to get TAB, LF, CR or a space not null. For a space I thought I should get

{"SPACE": ""}

My observation the JSON Encoder pipeline does not preserve whitespace if this is the only thing in the XML element. Does anyone know how get a space and not a null?

POSTSCRIPT

If I change all the elements to attributes I get a blank space.

{
  "@TAB": "\t",
  "@LF": "\n",
  "@CR": "\r",
  "@SPACE": " "
}

One Platform Operations, Monitoring and Analytics Software
BizTalk360

microsoft biztalk

Learn more

Over 500 customers across 30+ countries depend on BizTalk360

ServiceBus360

Azure service bus

Learn more

Start managing your Azure Service Bus namespaces in minutes

One Platform - Operations, Monitoring and Analytics Software
BizTalk360

microsoft biztalk

Learn more

Over 500 customers across 30+ countries depend on BizTalk360

One Platform - Operations, Monitoring and Analytics Software
ServiceBus360

Azure service bus

Learn more

Start managing your Azure Service Bus namespaces in minutes

Back to Top