1CTAGS-JSON-OUTPUT(5) Universal Ctags CTAGS-JSON-OUTPUT(5)
2
3
4
6 ctags-json-output - JSON based ctags output
7
9 ctags --output-format=json ...
10
11
13 Universal Ctags supports JSON (strictly speaking JSON Lines) output
14 format if the ctags executable is built with libjansson. JSON output
15 goes to standard output by default.
16
18 Each JSON line represents a tag.
19
20 $ ctags --extras=+p --output-format=json --fields=-s input.py
21 {"_type": "ptag", "name": "JSON_OUTPUT_VERSION", "path": "1.0", "pattern": "in development"}
22 {"_type": "ptag", "name": "TAG_FILE_SORTED", "path": "1", "pattern": "0=unsorted, 1=sorted, 2=foldcase"}
23 ...
24 {"_type": "tag", "name": "Klass", "path": "/tmp/input.py", "pattern": "/^class Klass:$/", "language": "Python", "kind": "class"}
25 {"_type": "tag", "name": "method", "path": "/tmp/input.py", "pattern": "/^ def method(self):$/", "language": "Python", "kind": "member", "scope": "Klass", "scopeKind": "class"}
26 ...
27
28 A key not starting with _ is mapped to a field of ctags. "--out‐
29 put-format=json --list-fields" options list the fields.
30
31 A key starting with _ represents meta information of the JSON line.
32 Currently only _type key is used. If the value for the key is tag, the
33 JSON line represents a regular tag. If the value is ptag, the line rep‐
34 resents a pseudo-tag.
35
36 The output format can be changed in the future. JSON_OUTPUT_VERSION
37 pseudo-tag provides a change client-tools to handle the changes. Cur‐
38 rent version is "1.0". A client-tool can extract the version with path
39 key from the pseudo-tag.
40
41 The JSON output format is newly designed and has no limitation found in
42 the default tags file format.
43
44 • The values for kind key are represented in long-name flags. No
45 one-letter is here.
46
47 • Scope names and scope kinds have distinguished keys: scope and
48 scopeKind. They are combined in the default tags file format.
49
51 Values for the most of all keys are represented in JSON string type.
52 However, some of them are represented in string, integer, and/or bool‐
53 ean type.
54
55 "--output-format=json --list-fields" options show What kind of data
56 type used in a field of JSON.
57
58 $ ctags --output-format=json --list-fields
59 #LETTER NAME ENABLED LANGUAGE JSTYPE FIXED DESCRIPTION
60 F input yes NONE s-- no input file
61 ...
62 P pattern yes NONE s-b no pattern
63 ...
64 f file yes NONE --b no File-restricted scoping
65 ...
66 e end no NONE -i- no end lines of various items
67 ...
68
69 JSTYPE column shows the data types.
70
71 's' string
72
73 'i' integer
74
75 'b' boolean (true or false)
76
77 For an example, the value for pattern field of ctags takes a string or
78 a boolean value.
79
81 Change since 0.0
82 • New key kindName for TAG_ROLE_DESCRIPTION pseudo tag
83
84 kindName is added to store the name of the kind in TAG_ROLE_DESCRIP‐
85 TION pseudo tags.
86
87 In 0.0, a "TAG_ROLE_DESCRIPTION" pseudo tag was printed like:
88
89 {"_type": "ptag", "name": "TAG_ROLE_DESCRIPTION",
90 "parserName": "LANG!KIND", }
91
92 In 1.0, it is printed like:
93
94 {"_type": "ptag", "name": "TAG_ROLE_DESCRIPTION",
95 "parserName": "LANG",
96 "kindName": "KIND", }
97
99 ctags(1), tags(5), ctags-client-tools(7)
100
101
102
103
1041.0 CTAGS-JSON-OUTPUT(5)