【问题标题】:Anypoint studio (mulesoft)Anypoint 工作室 (mulesoft)
【发布时间】:2018-05-08 15:02:59
【问题描述】:

我是 mulesoft 的新手。我想获得一个特定的值,或者我想从一组详细信息中获取而不使用数据库。

所以我使用文件连接器来发布和获取我的值。
我使用 mule requestor 读取文件作为将 CSV 文件转换为 json 的中间工作。现在它以 JSON 格式检索所有值。我无法获得特定的 id..

谁能帮忙解决这个问题?

【问题讨论】:

    标签: postman anypoint-studio


    【解决方案1】:

    假设您正在获取以下数据为 json 格式

    {
        "entries": [{
            "Profile Status": "3",
            "Remedy Login ID": "jorge.hawkins",
            "Person ID": "KKPPPLL123212457788"
        }]
    }
    

    然后请尝试以下语法从您的 json 数据中获取特定 ID

     #[json:entries[0]/'Person ID']
    

    【讨论】:

      【解决方案2】:

      您可以使用转换消息处理器将有效负载从 json 转换为 java。这将帮助您遍历对象中的任何节点。与任何其他对象类型相比,在 java 对象中的遍历要简单得多。
      如果您想在下面的有效负载中检索名称为“GHI”的客户的状态,您可以使用转换消息处理器将 json 转换为 java,并使用“payload[2].customer_detail.customer_status”下面的表达式来检索详细信息。例如。 json[{ "customer_name": "ABC", "customer_id": "1_ABC", "customer_detail": { "customer_age": 30, "customer_status": "Active" } }, { "customer_name": "DEF", "customer_id": "2_DEF", "customer_detail": { "customer_age": 31, "customer_status": "Inactive" } }, { "customer_name": "GHI", "customer_id": "3_GHI", "customer_detail": { "customer_age": 32, "customer_status": "Active" } }, ]

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-04-09
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-09-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多