-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.txt
91 lines (87 loc) · 4.48 KB
/
test.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
➜ ~ /usr/bin/python -V
Python 2.7.16
➜ ~ /usr/bin/python3 -V
Python 3.8.2
package.json
➜ ~ cat package.json|wc -m
209
具体内容如下:
{
"name": "lex",
"version": "1.0.0",
"description": "description",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
➜ ~ cat package.json|python2 -m json.tool
{
"author": "",
"description": "description",
"license": "ISC",
"main": "index.js",
"name": "lex",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "1.0.0"
}
➜ ~ cat package.json|python3 -m json.tool
{
"name": "lex",
"version": "1.0.0",
"description": "description",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
去掉了第十行
➜ ~ cat package.json|python3 -m json.tool
Expecting ',' delimiter: line 10 column 1 (char 207)
➜ ~ bat package.json
───────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: package.json
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ { "name": "lex",
2 │ "version": "1.0.0",
3 │ "description": "description",
4 │ "main": "index.js",
5 │ "scripts": {
6 │ "test": "echo \"Error: no test specified\" && exit 1"
7 │ },
8 │ "author": "",
9 │ "license": "ISC"
───────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────几个典型的报错分析:9行结尾➕了,
➜ ~ cat package.json|python3 -m json.tool
Expecting property name enclosed in double quotes: line 10 column 1 (char 208)
要求属性名用双引号括起来:第10行第1列
➜ ~ cat package.json|wc -m
210
➜ ~ bat package.json
───────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: package.json
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ { "name": "lex",
2 │ "version": "1.0.0",
3 │ "description": "description",
4 │ "main": "index.js",
5 │ "scripts": {
6 │ "test": "echo \"Error: no test specified\" && exit 1"
7 │ },
8 │ "author": "",
9 │ "license": "ISC",
10 │ }
───────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
➜ ~ cat package.json|python3 -m json.tool
Expecting ',' delimiter: line 5 column 3 (char 95)
在vim输入以下命令就可以格式化
:%!python -m json.tool
可以在~/.vimrc增加快捷键
map <F4> <Esc>:%!python -m json.tool<CR>
## add this Line for test merge from main to new