BizTalk JSON encoder pipeline generating incorrect JSON object from XSD












1














I am using BizTalk pipeline with JSON encoder to convert XML to JSON .
I have created the XSD but the JSON generated has #text instead of just a value for my elements.



Any ideas what I'm doing wrong?



<xs:schema attributeFormDefault="unqualified"      elementFormDefault="unqualified"     targetNamespace="http://BookingEngine.Schemas.JSONSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" name="affiliate_reference_id" type="xs:unsignedShort" />
<xs:element minOccurs="1" name="hold" type="xs:boolean" />
<xs:element minOccurs="1" maxOccurs="unbounded" name="rooms">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" name="email" type="xs:string" />

</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="1" maxOccurs="unbounded" name="payments">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" name="type" type="xs:string" />

</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="1" name="affiliate_metadata" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>


is converted to the following JSON



{
"affiliate_reference_id": {
"#text": "4480"
},
"hold": {
"#text": "false"
},
"rooms": [
{
"email": "john@example.com"
}
],
"payments": [
{
"type": "customer_card"
}
]
}


expected results would be



{
"affiliate_reference_id": "4480",
"hold": "false",
"rooms": [
{
"email": "john@example.com"
}
],
"payments": [
{
"type": "customer_card"
}
]
}


Any idea why the #text is popping up and how to remove it?
What do I need to change in my XSD schema?










share|improve this question
























  • Which version of BizTalk? I just tried it with BizTalk 2013 R2 and the output is as you expected.
    – Dijkgraaf
    Dec 25 at 8:29






  • 1




    That behaviour is similar to when you have attributes on elements see my blog post cdijkgraaf.wordpress.com/2016/05/23/…
    – Dijkgraaf
    Dec 25 at 8:36










  • @Dijkgraaf 2016
    – vaughn
    Dec 25 at 9:20










  • @Dijkgraaf so how do propose I solve this ? Create a custom pipeline ? Or change the schema so that #text is not created ?
    – vaughn
    Dec 25 at 9:25






  • 1




    Are you using BizTalk Standard or Enterprise? If Enterprise have you installed the Feature Packs. As part of Feature Pack 2 supports version 10.0.3 of Newtonsoft. See docs.microsoft.com/en-gb/biztalk/core/… Not sure what change you could do to the schema to stop it happening, as I cannot reproduce it in 2013 R2. I'll see if I can get access to a BizTalk 2016 environment, but that might not be until the new year
    – Dijkgraaf
    Dec 25 at 9:43


















1














I am using BizTalk pipeline with JSON encoder to convert XML to JSON .
I have created the XSD but the JSON generated has #text instead of just a value for my elements.



Any ideas what I'm doing wrong?



<xs:schema attributeFormDefault="unqualified"      elementFormDefault="unqualified"     targetNamespace="http://BookingEngine.Schemas.JSONSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" name="affiliate_reference_id" type="xs:unsignedShort" />
<xs:element minOccurs="1" name="hold" type="xs:boolean" />
<xs:element minOccurs="1" maxOccurs="unbounded" name="rooms">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" name="email" type="xs:string" />

</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="1" maxOccurs="unbounded" name="payments">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" name="type" type="xs:string" />

</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="1" name="affiliate_metadata" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>


is converted to the following JSON



{
"affiliate_reference_id": {
"#text": "4480"
},
"hold": {
"#text": "false"
},
"rooms": [
{
"email": "john@example.com"
}
],
"payments": [
{
"type": "customer_card"
}
]
}


expected results would be



{
"affiliate_reference_id": "4480",
"hold": "false",
"rooms": [
{
"email": "john@example.com"
}
],
"payments": [
{
"type": "customer_card"
}
]
}


Any idea why the #text is popping up and how to remove it?
What do I need to change in my XSD schema?










share|improve this question
























  • Which version of BizTalk? I just tried it with BizTalk 2013 R2 and the output is as you expected.
    – Dijkgraaf
    Dec 25 at 8:29






  • 1




    That behaviour is similar to when you have attributes on elements see my blog post cdijkgraaf.wordpress.com/2016/05/23/…
    – Dijkgraaf
    Dec 25 at 8:36










  • @Dijkgraaf 2016
    – vaughn
    Dec 25 at 9:20










  • @Dijkgraaf so how do propose I solve this ? Create a custom pipeline ? Or change the schema so that #text is not created ?
    – vaughn
    Dec 25 at 9:25






  • 1




    Are you using BizTalk Standard or Enterprise? If Enterprise have you installed the Feature Packs. As part of Feature Pack 2 supports version 10.0.3 of Newtonsoft. See docs.microsoft.com/en-gb/biztalk/core/… Not sure what change you could do to the schema to stop it happening, as I cannot reproduce it in 2013 R2. I'll see if I can get access to a BizTalk 2016 environment, but that might not be until the new year
    – Dijkgraaf
    Dec 25 at 9:43
















1












1








1







I am using BizTalk pipeline with JSON encoder to convert XML to JSON .
I have created the XSD but the JSON generated has #text instead of just a value for my elements.



Any ideas what I'm doing wrong?



<xs:schema attributeFormDefault="unqualified"      elementFormDefault="unqualified"     targetNamespace="http://BookingEngine.Schemas.JSONSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" name="affiliate_reference_id" type="xs:unsignedShort" />
<xs:element minOccurs="1" name="hold" type="xs:boolean" />
<xs:element minOccurs="1" maxOccurs="unbounded" name="rooms">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" name="email" type="xs:string" />

</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="1" maxOccurs="unbounded" name="payments">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" name="type" type="xs:string" />

</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="1" name="affiliate_metadata" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>


is converted to the following JSON



{
"affiliate_reference_id": {
"#text": "4480"
},
"hold": {
"#text": "false"
},
"rooms": [
{
"email": "john@example.com"
}
],
"payments": [
{
"type": "customer_card"
}
]
}


expected results would be



{
"affiliate_reference_id": "4480",
"hold": "false",
"rooms": [
{
"email": "john@example.com"
}
],
"payments": [
{
"type": "customer_card"
}
]
}


Any idea why the #text is popping up and how to remove it?
What do I need to change in my XSD schema?










share|improve this question















I am using BizTalk pipeline with JSON encoder to convert XML to JSON .
I have created the XSD but the JSON generated has #text instead of just a value for my elements.



Any ideas what I'm doing wrong?



<xs:schema attributeFormDefault="unqualified"      elementFormDefault="unqualified"     targetNamespace="http://BookingEngine.Schemas.JSONSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" name="affiliate_reference_id" type="xs:unsignedShort" />
<xs:element minOccurs="1" name="hold" type="xs:boolean" />
<xs:element minOccurs="1" maxOccurs="unbounded" name="rooms">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" name="email" type="xs:string" />

</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="1" maxOccurs="unbounded" name="payments">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" name="type" type="xs:string" />

</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="1" name="affiliate_metadata" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>


is converted to the following JSON



{
"affiliate_reference_id": {
"#text": "4480"
},
"hold": {
"#text": "false"
},
"rooms": [
{
"email": "john@example.com"
}
],
"payments": [
{
"type": "customer_card"
}
]
}


expected results would be



{
"affiliate_reference_id": "4480",
"hold": "false",
"rooms": [
{
"email": "john@example.com"
}
],
"payments": [
{
"type": "customer_card"
}
]
}


Any idea why the #text is popping up and how to remove it?
What do I need to change in my XSD schema?







json biztalk pipeline encoder biztalk-2016






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 25 at 9:38









Dijkgraaf

7,23272744




7,23272744










asked Dec 25 at 6:27









vaughn

156




156












  • Which version of BizTalk? I just tried it with BizTalk 2013 R2 and the output is as you expected.
    – Dijkgraaf
    Dec 25 at 8:29






  • 1




    That behaviour is similar to when you have attributes on elements see my blog post cdijkgraaf.wordpress.com/2016/05/23/…
    – Dijkgraaf
    Dec 25 at 8:36










  • @Dijkgraaf 2016
    – vaughn
    Dec 25 at 9:20










  • @Dijkgraaf so how do propose I solve this ? Create a custom pipeline ? Or change the schema so that #text is not created ?
    – vaughn
    Dec 25 at 9:25






  • 1




    Are you using BizTalk Standard or Enterprise? If Enterprise have you installed the Feature Packs. As part of Feature Pack 2 supports version 10.0.3 of Newtonsoft. See docs.microsoft.com/en-gb/biztalk/core/… Not sure what change you could do to the schema to stop it happening, as I cannot reproduce it in 2013 R2. I'll see if I can get access to a BizTalk 2016 environment, but that might not be until the new year
    – Dijkgraaf
    Dec 25 at 9:43




















  • Which version of BizTalk? I just tried it with BizTalk 2013 R2 and the output is as you expected.
    – Dijkgraaf
    Dec 25 at 8:29






  • 1




    That behaviour is similar to when you have attributes on elements see my blog post cdijkgraaf.wordpress.com/2016/05/23/…
    – Dijkgraaf
    Dec 25 at 8:36










  • @Dijkgraaf 2016
    – vaughn
    Dec 25 at 9:20










  • @Dijkgraaf so how do propose I solve this ? Create a custom pipeline ? Or change the schema so that #text is not created ?
    – vaughn
    Dec 25 at 9:25






  • 1




    Are you using BizTalk Standard or Enterprise? If Enterprise have you installed the Feature Packs. As part of Feature Pack 2 supports version 10.0.3 of Newtonsoft. See docs.microsoft.com/en-gb/biztalk/core/… Not sure what change you could do to the schema to stop it happening, as I cannot reproduce it in 2013 R2. I'll see if I can get access to a BizTalk 2016 environment, but that might not be until the new year
    – Dijkgraaf
    Dec 25 at 9:43


















Which version of BizTalk? I just tried it with BizTalk 2013 R2 and the output is as you expected.
– Dijkgraaf
Dec 25 at 8:29




Which version of BizTalk? I just tried it with BizTalk 2013 R2 and the output is as you expected.
– Dijkgraaf
Dec 25 at 8:29




1




1




That behaviour is similar to when you have attributes on elements see my blog post cdijkgraaf.wordpress.com/2016/05/23/…
– Dijkgraaf
Dec 25 at 8:36




That behaviour is similar to when you have attributes on elements see my blog post cdijkgraaf.wordpress.com/2016/05/23/…
– Dijkgraaf
Dec 25 at 8:36












@Dijkgraaf 2016
– vaughn
Dec 25 at 9:20




@Dijkgraaf 2016
– vaughn
Dec 25 at 9:20












@Dijkgraaf so how do propose I solve this ? Create a custom pipeline ? Or change the schema so that #text is not created ?
– vaughn
Dec 25 at 9:25




@Dijkgraaf so how do propose I solve this ? Create a custom pipeline ? Or change the schema so that #text is not created ?
– vaughn
Dec 25 at 9:25




1




1




Are you using BizTalk Standard or Enterprise? If Enterprise have you installed the Feature Packs. As part of Feature Pack 2 supports version 10.0.3 of Newtonsoft. See docs.microsoft.com/en-gb/biztalk/core/… Not sure what change you could do to the schema to stop it happening, as I cannot reproduce it in 2013 R2. I'll see if I can get access to a BizTalk 2016 environment, but that might not be until the new year
– Dijkgraaf
Dec 25 at 9:43






Are you using BizTalk Standard or Enterprise? If Enterprise have you installed the Feature Packs. As part of Feature Pack 2 supports version 10.0.3 of Newtonsoft. See docs.microsoft.com/en-gb/biztalk/core/… Not sure what change you could do to the schema to stop it happening, as I cannot reproduce it in 2013 R2. I'll see if I can get access to a BizTalk 2016 environment, but that might not be until the new year
– Dijkgraaf
Dec 25 at 9:43














2 Answers
2






active

oldest

votes


















1














‪I've the same result in c# when using Newtonsoft. The #text nodes are added when they have a different namespace than the root-namespace because in JSON it becomes an object with a text and a attribute namespace. ‬






share|improve this answer








New contributor




Gert Vloo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • Ahhh makes sense.... made a custom pipeline and removed all namespaces and it works now..... guess i could of just matched the namespaces correctly.
    – vaughn
    Dec 26 at 12:05












  • @vaughn Give that a go and if that works, post it as the answer. However you XSD didn't have two namespaces. Did you payload have a different namespace for some of the elements? Yes, that can cause havoc with the JSON encoder.
    – Dijkgraaf
    Dec 26 at 19:45





















0














I added a custom biztalk pipeline and used json newton soft nuget package .






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53919898%2fbiztalk-json-encoder-pipeline-generating-incorrect-json-object-from-xsd%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    ‪I've the same result in c# when using Newtonsoft. The #text nodes are added when they have a different namespace than the root-namespace because in JSON it becomes an object with a text and a attribute namespace. ‬






    share|improve this answer








    New contributor




    Gert Vloo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.


















    • Ahhh makes sense.... made a custom pipeline and removed all namespaces and it works now..... guess i could of just matched the namespaces correctly.
      – vaughn
      Dec 26 at 12:05












    • @vaughn Give that a go and if that works, post it as the answer. However you XSD didn't have two namespaces. Did you payload have a different namespace for some of the elements? Yes, that can cause havoc with the JSON encoder.
      – Dijkgraaf
      Dec 26 at 19:45


















    1














    ‪I've the same result in c# when using Newtonsoft. The #text nodes are added when they have a different namespace than the root-namespace because in JSON it becomes an object with a text and a attribute namespace. ‬






    share|improve this answer








    New contributor




    Gert Vloo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.


















    • Ahhh makes sense.... made a custom pipeline and removed all namespaces and it works now..... guess i could of just matched the namespaces correctly.
      – vaughn
      Dec 26 at 12:05












    • @vaughn Give that a go and if that works, post it as the answer. However you XSD didn't have two namespaces. Did you payload have a different namespace for some of the elements? Yes, that can cause havoc with the JSON encoder.
      – Dijkgraaf
      Dec 26 at 19:45
















    1












    1








    1






    ‪I've the same result in c# when using Newtonsoft. The #text nodes are added when they have a different namespace than the root-namespace because in JSON it becomes an object with a text and a attribute namespace. ‬






    share|improve this answer








    New contributor




    Gert Vloo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.









    ‪I've the same result in c# when using Newtonsoft. The #text nodes are added when they have a different namespace than the root-namespace because in JSON it becomes an object with a text and a attribute namespace. ‬







    share|improve this answer








    New contributor




    Gert Vloo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.









    share|improve this answer



    share|improve this answer






    New contributor




    Gert Vloo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.









    answered Dec 26 at 7:16









    Gert Vloo

    111




    111




    New contributor




    Gert Vloo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





    New contributor





    Gert Vloo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






    Gert Vloo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.












    • Ahhh makes sense.... made a custom pipeline and removed all namespaces and it works now..... guess i could of just matched the namespaces correctly.
      – vaughn
      Dec 26 at 12:05












    • @vaughn Give that a go and if that works, post it as the answer. However you XSD didn't have two namespaces. Did you payload have a different namespace for some of the elements? Yes, that can cause havoc with the JSON encoder.
      – Dijkgraaf
      Dec 26 at 19:45




















    • Ahhh makes sense.... made a custom pipeline and removed all namespaces and it works now..... guess i could of just matched the namespaces correctly.
      – vaughn
      Dec 26 at 12:05












    • @vaughn Give that a go and if that works, post it as the answer. However you XSD didn't have two namespaces. Did you payload have a different namespace for some of the elements? Yes, that can cause havoc with the JSON encoder.
      – Dijkgraaf
      Dec 26 at 19:45


















    Ahhh makes sense.... made a custom pipeline and removed all namespaces and it works now..... guess i could of just matched the namespaces correctly.
    – vaughn
    Dec 26 at 12:05






    Ahhh makes sense.... made a custom pipeline and removed all namespaces and it works now..... guess i could of just matched the namespaces correctly.
    – vaughn
    Dec 26 at 12:05














    @vaughn Give that a go and if that works, post it as the answer. However you XSD didn't have two namespaces. Did you payload have a different namespace for some of the elements? Yes, that can cause havoc with the JSON encoder.
    – Dijkgraaf
    Dec 26 at 19:45






    @vaughn Give that a go and if that works, post it as the answer. However you XSD didn't have two namespaces. Did you payload have a different namespace for some of the elements? Yes, that can cause havoc with the JSON encoder.
    – Dijkgraaf
    Dec 26 at 19:45















    0














    I added a custom biztalk pipeline and used json newton soft nuget package .






    share|improve this answer


























      0














      I added a custom biztalk pipeline and used json newton soft nuget package .






      share|improve this answer
























        0












        0








        0






        I added a custom biztalk pipeline and used json newton soft nuget package .






        share|improve this answer












        I added a custom biztalk pipeline and used json newton soft nuget package .







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 27 at 14:31









        vaughn

        156




        156






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53919898%2fbiztalk-json-encoder-pipeline-generating-incorrect-json-object-from-xsd%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Monofisismo

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas