【发布时间】:2021-10-27 01:35:39
【问题描述】:
我在 Azure 逻辑应用步骤的输出中显示一个错误,该错误的操作类型为“Transform_JSON_to_JSON”(我用来转换某些 JSON 的 Liquid 转换)。我没有看到导致错误的原因?
液体动作的输入如下。此格式为有效 JSON
[{"DeviceType":"Scanner","Code":"ABC","CustomerId":null,"FirstName":"John","LastName":"Doe","TransactionType":"Actionable","TransactionSubTypes":["ScanFailed"],"Message":"Scan failed.","Data":null,"Status":"Pending","Text":null,"AgentId":null,"AgentName":null,"NodeId":"12345","Timestamp":"2021-10-26T22:43:37.695759+00:00","UTCTimeStamp":"2021-10-26T22:43:37.695763Z"}]
液体模板为:
[
{% for transaction in content %}
{
"DeviceType": "{{content.DeviceType}}",
"Code": "{{content.Code}}"
}
{% endfor %}
]
Azure 逻辑应用设计器中的流操作的原始输出是
"{\"StatusCode\":400,\"ErrorCode\":18,\"Details\":null,\"Message\":\"An error occurred while converting the transformed value to JSON. The transformed value is not a valid JSON. 'After parsing a value an unexpected character was encountered: {. Path '[0]', line 8, position 6.'\",\"Data\":{},\"InnerException\":{\"ClassName\":\"Newtonsoft.Json.JsonReaderException\",\"Message\":\"After parsing a value an unexpected character was encountered: {. Path '[0]', line 8, position 6.\",\"Data\":null,\"InnerException\":null,\"HelpURL\":null,\"StackTraceString\":\" at Newtonsoft.Json.JsonTextReader.ParsePostValue(Boolean ignoreComments)\\r\\n at Newtonsoft.Json.JsonTextReader.Read()\\r\\n at Newtonsoft.Json.Linq.JContainer.ReadContentFrom(JsonReader r, JsonLoadSettings settings)\\r\\n at Newtonsoft.Json.Linq.JContainer.ReadTokenFrom(JsonReader reader, JsonLoadSettings options)\\r\\n at Newtonsoft.Json.Linq.JArray.Load(JsonReader reader, JsonLoadSettings settings)\\r\\n at Newtonsoft.Json.Linq.JToken.ReadFrom(JsonReader reader, JsonLoadSettings settings)\\r\\n at Newtonsoft.Json.Linq.JToken.Parse(String json, JsonLoadSettings settings)\\r\\n at Microsoft.Azure.Function.Common.BaseLiquidTransformer.ParseTransformedContent(String transformedContent, JSchema schema) in X:\\\\bt\\\\1186352\\\\repo\\\\src\\\\functions\\\\Scripts\\\\Function.Common\\\\Liquid\\\\BaseLiquidTransformer.cs:line 127\",\"RemoteStackTraceString\":null,\"RemoteStackIndex\":0,\"ExceptionMethod\":\"8\\nParsePostValue\\nNewtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed\\nNewtonsoft.Json.JsonTextReader\\nBoolean ParsePostValue(Boolean)\",\"HResult\":-2146233088,\"Source\":\"Newtonsoft.Json\",\"WatsonBuckets\":null},\"TargetSite\":{\"Name\":\"ParseTransformedContent\",\"AssemblyName\":\"Microsoft.Azure.Function.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\",\"ClassName\":\"Microsoft.Azure.Function.Common.BaseLiquidTransformer\",\"Signature\":\"Newtonsoft.Json.Linq.JToken ParseTransformedContent(System.String, Newtonsoft.Json.Schema.JSchema)\",\"Signature2\":\"Newtonsoft.Json.Linq.JToken ParseTransformedContent(System.String, Newtonsoft.Json.Schema.JSchema)\",\"MemberType\":8,\"GenericArguments\":null},\"StackTrace\":\" at Microsoft.Azure.Function.Common.BaseLiquidTransformer.ParseTransformedContent(String transformedContent, JSchema schema) in X:\\\\bt\\\\1186352\\\\repo\\\\src\\\\functions\\\\Scripts\\\\Function.Common\\\\Liquid\\\\BaseLiquidTransformer.cs:line 133\\r\\n at Microsoft.Azure.Function.LiquidTransform.LiquidTransformRequestProcessor.GetTransformedContentResponseMessage(HttpRequestMessage request, LiquidTransformKind transformKind, String transformedContent, JSchema outputSchema) in X:\\\\bt\\\\1186352\\\\repo\\\\src\\\\functions\\\\Scripts\\\\Function.LiquidTransform\\\\LiquidTransformRequestProcessor.cs:line 91\\r\\n at Microsoft.Azure.Function.LiquidTransform.LiquidTransformRequestProcessor.<ProcessRequest>d__2.MoveNext() in X:\\\\bt\\\\1186352\\\\repo\\\\src\\\\functions\\\\Scripts\\\\Function.LiquidTransform\\\\LiquidTransformRequestProcessor.cs:line 60\",\"HelpLink\":null,\"Source\":\"Microsoft.Azure.Function.Common\",\"HResult\":-2146233088}"
【问题讨论】:
标签: json liquid azure-logic-apps dotliquid