JQ从查询中获取编译错误响应

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

我想请您为我这样的新手提供有关在示例文件上测试查询的指南。我在测试时遇到编译错误。请就需要调整的内容提出建议。

JSON文件-> sample.json

    {
    "lambda": {
        "apple": [
            {
                "type": "fruit",
                "color": "red",
                "shape": "round",
                "cron": "0/10 * * * ? *"
            }
        ],
        "orange": [
            {
                "type": "fruit",
                "color": "orange",
                "shape": "round",
                "cron": "0/15 * * * ? *"
            }
        ],
        "apple-cider": [
            {
                "type": "juice",
                "color": "pink",
                "shape": "none",
                "cron": "0/30 * * * ? *"
            }
        ]
    }
}

我在尝试从apple-cider获取数据时收到此jq:1编译错误消息

# jq -r ".lambda."apple-cider"[].shape" test.json
jq: error: cider/0 is not defined at <top-level>, line 1:
.lambda.apple-cider[].shape
jq: 1 compile error

我想请您为我这样的新手提供有关在示例文件上测试查询的指南。我在测试时遇到编译错误。请提出需要调整的建议。 JSON文件-> ...

syntax jq
1个回答
0
投票

[此回复回答了最初发布的问题。修改之前,输入的是JSON对象流。]

© www.soinside.com 2019 - 2024. All rights reserved.