簡(jiǎn)介
catj是一個(gè)可以將JSON文件以平鋪的格式顯示出來(lái)的腳本工具。
編譯和測(cè)試方式
1. 配置安裝環(huán)境
1) 安裝wget。
yum install wget -y
2) 安裝npm。
yum install npm
----結(jié)束
2.安裝
以npm方式安裝catj。
cd /usr/local/src
npm install -g catj
3.運(yùn)行和驗(yàn)證
1)創(chuàng)建測(cè)試源文件。
cd /usr/local/src
vi test.json
在“test.json”輸入如下內(nèi)容:
{
"mappings": {
"templates": [
{
"fields": {
"mapping": {
"norms": false,
"type": "text",
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
}
}
}
}
]
}
}
2)運(yùn)行測(cè)試文件。
catj test.json
回顯內(nèi)容如下,表示結(jié)果正常。
[root@ecs-centos-a ~]# catj test.json
.mappings.templates[0].fields.mapping.norms = false
.mappings.templates[0].fields.mapping.type = "text"
.mappings.templates[0].fields.mapping.fields.keyword.ignore_above = 256
.mappings.templates[0].fields.mapping.fields.keyword.type = "keyword"
----結(jié)束