Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Json jq-组合来自不同键的数据_Json_Key_Jq - Fatal编程技术网

Json jq-组合来自不同键的数据

Json jq-组合来自不同键的数据,json,key,jq,Json,Key,Jq,我有这个json输出 { "FileSystems": [ { "CreationToken": "CreationToken1", "OwnerId": "OwnerId1", "SizeInBytes": { "Timestamp": 1552377599.0, "Value": 1550721024 }, "Name": "Name1",

我有这个json输出

{
"FileSystems": [
    {
        "CreationToken": "CreationToken1",
        "OwnerId": "OwnerId1",
        "SizeInBytes": {
            "Timestamp": 1552377599.0,
            "Value": 1550721024
        },
        "Name": "Name1",
        "NumberOfMountTargets": 3,
        "FileSystemId": "fs-1",
        "LifeCycleState": "available",
        "CreationTime": 1550506468.0,
        "PerformanceMode": "generalPurpose"
    },
    {
        "CreationToken": "CreationToken2",
        "OwnerId": "OwnerId2",
        "SizeInBytes": {
            "Timestamp": 1552377599.0,
            "Value": 2390339584
        },
        "Name": "Name2",
        "NumberOfMountTargets": 3,
        "FileSystemId": "fs-2",
        "LifeCycleState": "available",
        "CreationTime": 1547663741.0,
        "PerformanceMode": "generalPurpose"
    }
]
}
通过使用此命令

aws efs describe-file-systems | jq -r ".FileSystems[] | .SizeInBytes.Value"
我可以接收NFS大小的值:

1550725120
2390339584
但是我需要得到一个文件系统名的输出,所以应该是这样的:

Name1: 1550725120
Name2: 2390339584
我该怎么做呢?

您可以这样使用:

jq -r ".FileSystems[] | \"\(.Name) \(.SizeInBytes.Value)\""