【发布时间】:2020-08-30 15:58:28
【问题描述】:
我有一个 json 文件,代表一个有两列的表。
列值在一个数组中
{
'columnA':[1,2,3],
'columnB':[6,7,8]
}
我需要将其转换为行数组:
[
{'columnA':1, 'columnB':6},
{'columnA':2, 'columnB':7},
{'columnA':3, 'columnB':8},
]
【问题讨论】:
-
您为自己尝试了什么?纯 JSON 不为关键字段使用单引号
-
transpose导致错误:Cannot index object with number force string keys withto_entriesor evenmap(to_entries)did not lead to any usefull butmapwill only ittererate one column and not result以任意键访问第二列
标签: arrays json object jq transpose