【发布时间】:2019-04-19 14:17:55
【问题描述】:
我想获取我的 json 文件的第一个对象(不知道它是否是正确的名称),该文件很大(超过 120k 行),所以我无法手动解析它。
格式是这样的:
"datanode": [
{
"isWhitelisted": true,
"metricname": "write_time",
"seriesStartTime": 1542037566944,
"supportsAggregation": true
},
{
"isWhitelisted": true,
"metricname": "dfs.datanode.CacheReportsNumOps",
"seriesStartTime": 1542037501137,
"supportsAggregation": true,
"type": "COUNTER"
},
{
"isWhitelisted": true,
"metricname": "FSDatasetState.org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.FsDatasetImpl.EstimatedCapacityLostTotal",
"seriesStartTime": 1542037495521,
"supportsAggregation": true,
"type": "GAUGE"
},
],
"toto": [
....
我需要的是提取这个:datanode、toto 等。只有名称。
你能帮帮我吗?
我尝试使用 jq 没有成功。
【问题讨论】:
-
向我们展示正确的 JSON 内容,而不是不完整的结构