none
BizTalk 2013 R2 Json Schema Wizard problem RRS feed

  • General discussion

  • Hi, just started on the Json Schema Wizard and hit a problem straight away :-(

    I implemented a WebApi sample and got this Json:

    [{"Id":1,"Name":"Tomato Soup","Category":"Groceries","Price":1.0},{"Id":2,"Name":"Yo-yo","Category":"Toys","Price":3.75},{"Id":3,"Name":"Hammer","Category":"Hardware","Price":16.99},{"Id":4,"Name":"HSB","Category":"Beer","Price":4.99}]

    I tried to use the 2013R2 Json Schema wizard to import it. However it failed. The error was cryptic but I guessed that adding an object up front would solve the problem and it did.

    It seems the problem is that the Json wizard only works with Json if it could just as easily be passed as xml in the first place. I can easily change the web service to effectively provide a root node. However you can generally do that. You cant expect folks to tailor there service, you have to go with what you have.

    Can you generally import whatever Json you get? 

    thanks


    mark

    Thursday, August 7, 2014 5:05 PM

All replies

  • Your "problem" is that you are sending in an array of objects, which doesn't make sense in an XML world (hence: doesn't make sense in a BizTalk world then!).

    I tried to submit an array to the JSON-decoder component and got the following error:

    "XmlNodeConverter can only convert JSON that begins with an object."

    So even if the Wizard worked, it would not be able to receive it anyway.

    Having said this, I believe this is a big problem. This sort of deems the new JSON Pipeline Components useless, since WebAPI's (including the ASP.NET WebAPI!), JavaScript, JQuery, AngularJs etc. often works directly with arrays of JSON objects.

    Morten la Cour

    Friday, August 8, 2014 5:28 AM
  • Morten,

    that's the same error I encountered.

    I forgot to add the wizard interface allows for the provision of a root node and namespace but the root node seems to be ignored.

    What I had hoped as the wizard would add the provided root node and the pipeline components would add and/or remove it as required.


    mark

    Sunday, August 10, 2014 9:41 AM
  • I'm just facing the same issue.

    The solution I was thinking of, is to have in the Assemble pipeline the JSON encoder

    and in the Encode Stage, using a custom component to remove the Header and what needs to be removed in order to comply with the expected JSON Object (by using for instance the Newtonsoft standard dll, to parse and do what needs to be done...)

    I'll try this option to see if it works :-)


    Reporting Solution for BizTalk | follow-us on twitter

    Tuesday, March 15, 2016 4:19 PM
  • Hi,

    I have worked on the JSON.

    If the JSON message is created client means , First convert the json to xml and create a schema

    Else Create a JSON schema by your own and share it to client, if there is any discrepency then add those value and convert to XML.

    use this tool for converting JSON to XML:

    JSONToXML


    Regards, Aboorva Raja R Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 21, 2016 9:15 AM