逻辑应用程序-XML到JSON对象数组为null [英] Logic App -- XML to JSON Object Array null
问题描述
大家好,
我有一个问题,我正在转换具有以下模式的XML SOAP消息到JSON.
I have a question, I am converting a XML soap message to JSON with the following Schema.
转换是 @json(xml(body('Haal_posities_op')))
the convert is @json(xml(body('Haal_posities_op')))
也用xpath尝试过,但是我一直在告诉我它是一个空数组的位置.但是当我检查原始结果时,数组就被填充了.
is also tried with xpath but i keeps telling me on the positions it is an empty array. But when i check the raw result, the array is filled.
我删除了一些内部数据,消息如下:
i remove somed inner data bat te soap message looks live the following:
{
"type": "object",
"properties": {
"positions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"AAP24": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"accountDescription": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"accountExternalId": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"accountName": {
"type": "string"
},
"applicationUrl": {
"type": "string"
},
"companyInformation": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"companyLocation": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"compensationBenefits": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"contactInfo": {
"type": "string"
},
"contractType": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"country": {
"type": "string"
},
"custom1": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"custom2": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"custom3": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"custom4": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"custom5": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"customFields": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"key",
"value"
]
}
},
"customRich1": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"customRich2": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"durationNumberOfUnit": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"durationProlongationOptional": {
"type": "string"
},
"durationUnit": {
"type": "string"
},
"endDate": {
"type": "string"
},
"externalId": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"featuredJob": {
"type": "string"
},
"functionExternalId": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"hiringManager": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"externalId": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"firstName": {
"type": "string"
},
"gender": {
"type": "string"
},
"id": {
"type": "string"
},
"lastName": {
"type": "string"
},
"logoUrl": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"mobilePhone": {
"type": "string"
},
"name": {
"type": "string"
},
"phone": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
}
}
},
"hoursPerWeek": {
"type": "string"
},
"hrAdvisor": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"externalId": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"firstName": {
"type": "string"
},
"gender": {
"type": "string"
},
"id": {
"type": "string"
},
"lastName": {
"type": "string"
},
"logoUrl": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"mobilePhone": {
"type": "string"
},
"name": {
"type": "string"
},
"phone": {
"type": "string"
}
}
},
"id": {
"type": "string"
},
"jobDescription": {
"type": "string"
},
"jobEndDate": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"jobLocationZipCode": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"jobRequirements": {
"type": "string"
},
"jobStartDate": {
"type": "string"
},
"jobType": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"location": {
"type": "string"
},
"name": {
"type": "string"
},
"onlineApplicationAllowed": {
"type": "string"
},
"positionUrl": {
"type": "string"
},
"questionUrl": {
"type": "string"
},
"recruiter": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"externalId": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"firstName": {
"type": "string"
},
"gender": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"id": {
"type": "string"
},
"lastName": {
"type": "string"
},
"logoUrl": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"mobilePhone": {
"type": "string"
},
"name": {
"type": "string"
},
"phone": {
"type": "string"
}
}
},
"salary": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"salaryLevel": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"salaryMaximum": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"salaryMinimum": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
},
"salaryPeriod": {
"type": "string"
},
"startDate": {
"type": "string"
},
"subTitle": {
"type": "object",
"properties": {
"@xsi:nil": {
"type": "string"
}
}
}
},
"required": [
"AAP24",
"accountDescription",
"accountExternalId",
"accountName",
"applicationUrl",
"companyInformation",
"companyLocation",
"compensationBenefits",
"contactInfo",
"contractType",
"country",
"custom1",
"custom2",
"custom3",
"custom4",
"custom5",
"customFields",
"customRich1",
"customRich2",
"durationNumberOfUnit",
"durationProlongationOptional",
"durationUnit",
"endDate",
"externalId",
"featuredJob",
"functionExternalId",
"hiringManager",
"hoursPerWeek",
"hrAdvisor",
"id",
"jobDescription",
"jobEndDate",
"jobLocationZipCode",
"jobRequirements",
"jobStartDate",
"jobType",
"location",
"name",
"onlineApplicationAllowed",
"positionUrl",
"questionUrl",
"recruiter",
"salary",
"salaryLevel",
"salaryMaximum",
"salaryMinimum",
"salaryPeriod",
"startDate",
"subTitle"
]
}
}
}
}
但是每次我尝试
推荐答案
文森特嗨
当您尝试进行此转换时,编码设置为什么?由于您已经提到XML数据属于SOAP消息,因此我假设您已经具有"Content-type"标头设置为"application/xml",在这种情况下,您可以 只是做:
What is the encoding set to when you attempt to do this conversion? Since you've mentioned that the XML data is of a SOAP message, I'm assuming that you already have "Content-type" header set to "application/xml", in which case, you can just do:
@{json(xml(triggerBody()))}
当我插入上面共享的示例XML数据集并将此数据成功转换为有效JSON时,这对我有用.希望能对您有所帮助,让我知道是否还有其他详细信息,我很乐意加入:)
This works for me when I plug in the sample XML data set that you've shared above and am successfully converting the this data to a valid JSON. Hope this helps, let me know if there are further details and I'd be happy to weight in :)
这篇关于逻辑应用程序-XML到JSON对象数组为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!