如何从Apigee的JSON Payload中提取JSON变量?

问题描述 投票:0回答:1

以下JSON作为响应-

{
  "result": {
    "status": "ERROR",
    "error": {
      "errorCode": "x500",
      "errorType": "string500",
      "errorMessage": "string700"
    }
  }
}

我可以成功提取以下变量-

<JSONPayload>
   <Variable name="result">
      <JSONPath>$.result</JSONPath>
   </Variable>
   <Variable name="status">
      <JSONPath>$.result.status</JSONPath>
   </Variable>
   <Variable name="errorCode">
      <JSONPath>$.result.error.errorCode</JSONPath>
   </Variable>
   <Variable name="errorType">
      <JSONPath>$.result.error.errorType</JSONPath>
   </Variable>
   <Variable name="errorMessage">
      <JSONPath>$.result.error.errorMessage</JSONPath>
   </Variable>
</JSONPayload>

但是,当我尝试从error对象中提取完整的JSON对象时,它显示无法执行ExtractVariables] >>

<Variable name="error">
   <JSONPath>$.result.error</JSONPath>
</Variable>

以下JSON用作响应-{“结果”:{“状态”:“错误”,“错误”:{“错误代码”:“ x500”,“错误类型”:“字符串500”,“错误消息”: “ string700”}}} ...

apigee
1个回答
0
投票

选择error以外的其他名称,因为它是Apigee平台中的保留字,因此显示失败消息。

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.