【问题标题】:How to extract a JSON variable from JSON Payload in Apigee?如何从 Apigee 中的 JSON Payload 中提取 JSON 变量?
【发布时间】:2020-03-22 07:30:28
【问题描述】:

下面的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>

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

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

【问题讨论】:

    标签: apigee


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-11-02
      • 1970-01-01
      • 1970-01-01
      • 2021-05-27
      • 1970-01-01
      • 2020-03-08
      • 2014-08-20
      • 1970-01-01
      相关资源
      最近更新 更多