BizTalk 2013-解码JSON数组 [英] BizTalk 2013 - decode JSON array

查看:89
本文介绍了BizTalk 2013-解码JSON数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用BizTalk 2013,可以直接从JSON实体创建XSD架构,并在接收管道中使用JSON解码器将JSON消息转换为XML.

Using BizTalk 2013 it is straightforward to create a XSD schema from a JSON entity and use the JSON decoder in a receive pipeline to convert a JSON message into XML.

但是,当外部系统发送用

However when the external system sends an array of JSON entities enclosed with the

array []语法

array [] syntax

JSON解码器发生错误

the JSON decoder falls over with error

XmlNodeConverter只能转换以对象开头的JSON

XmlNodeConverter can only convert JSON that begins with an object

为解决此问题,我尝试使用JSON模式向导和JSON数组数据的示例创建新的XSD模式-但是该向导也无法识别该数组.

In an attempt to fix this I tried to create a new XSD schema using the JSON Schema Wizard and an example of the JSON array data - however the wizard could also not recognise the array.

如何将接收管道中的JSON解码器配置为解码对象数组?

How can the JSON decoder in a receive pipleline be configured to decode an array of objects?

推荐答案

一种可能的解决方案是创建您自己的自定义管道组件,该组件扩展了JSON解码器.您可以通过将其修改为单个对象,或将其拆分为多个对象,然后通过基础JSON解码器分别发送每个对象,来准备JSON数据.

One possible solution would be to create your own custom pipeline component which extends the JSON decoder. You can use this to prepare the JSON data by modifying it to be a single object, or by splitting it into a number of objects and sending each one individually through the underlying JSON decoder.

Microsoft已发布一个示例,说明如何使用平面文件反汇编程序执行类似任务,该示例可在BizTalk SDK随附的示例中找到

Microsoft have published an example of how to do a similar task with the flat file disassembler which can be found in the samples that come with the BizTalk SDK

逻辑相同,因此您应该能够调整这些步骤以扩展JSON解码器.

The logic is the same so you should be able to adapt these steps to extend the JSON decoder.

这篇关于BizTalk 2013-解码JSON数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆