我真的很难完成这个简单的任务。我正在尝试将其转换为
[
"arn:aws:iam::123456789012:role/masters.a.eu.somewhere.com",
"arn:aws:iam::123456789012:role/masters.b.eu.somewhere.com",
"arn:aws:iam::123456789012:role/masters.c.eu.somewhere.com"
]
对于这样的事情:
{
"0": "arn:aws:iam::123456789012:role/masters.a.eu.somewhere.com",
"1": "arn:aws:iam::123456789012:role/masters.b.eu.somewhere.com",
"2": "arn:aws:iam::123456789012:role/masters.c.eu.somewhere.com"
}
仅使用JQ。我尝试使用“ to_entries”,但未获得所需的输出。任何建议表示赞赏。
答案 0 :(得分:2)
诚然,这并不明显,但是很短的解决方案是:
with_entries(.key |= tostring)
更行人但仍完全受人尊敬的解决方案是:
. as $in
| reduce range(0;length) as $i ({}; . + {($i|tostring): $in[$i]})