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": " "
}

turbo360

Back to Top