ctags-json-output(5) Universal Ctags ctags-json-output(5)

# [Name](#Name)

ctags-json-output - JSON based ctags output

# [SYNOPSIS](#SYNOPSIS)

```
ctags --output-format=json ...
```

# [DESCRIPTION](#DESCRIPTION)

Universal Ctags supports JSON &lt;https://www.json.org/&gt; (strictly speaking JSON Lines &lt;https://jsonlines.org/&gt;) output format if the ctags executable is built with **libjansson**. JSON output goes to standard output by default.

# [FORMAT](#FORMAT)

Each JSON line represents a tag.

```
$ ctags --extras=+p --output-format=json --fields=-s input.py
{"_type": "ptag", "name": "JSON_OUTPUT_VERSION", "path": "1.0", "pattern": "in development"}
{"_type": "ptag", "name": "TAG_FILE_SORTED", "path": "1", "pattern": "0=unsorted, 1=sorted, 2=foldcase"}
...
{"_type": "tag", "name": "Klass", "path": "/tmp/input.py", "pattern": "/^class Klass:$/", "language": "Python", "kind": "class"}
{"_type": "tag", "name": "method", "path": "/tmp/input.py", "pattern": "/^    def method(self):$/", "language": "Python", "kind": "member", "scope": "Klass", "scopeKind": "class"}
...
```

A key not starting with **\_** is mapped to a field of ctags. "**--output-format=json --list-fields**" options list the fields.

A key starting with **\_** represents meta information of the JSON line. Currently only **\_type** key is used. If the value for the key is **tag**, the JSON line represents a regular tag. If the value is **ptag**, the line represents a pseudo-tag.

The output format can be changed in the future. **JSON\_OUTPUT\_VERSION** pseudo-tag provides a change client-tools to handle the changes. Current version is "1.0". A client-tool can extract the version with **path** key from the pseudo-tag.

The JSON output format is newly designed and has no limitation found in the default tags file format.

- The values for **kind** key are represented in long-name flags. No one-letter is here.
- Scope names and scope kinds have distinguished keys: **scope** and **scopeKind**. They are combined in the default tags file format.

# [DATA TYPE USED IN A FIELD](#DATA_TYPE_USED_IN_A_FIELD)

Values for the most of all keys are represented in JSON string type. However, some of them are represented in string, integer, and/or boolean type.

"**--output-format=json --list-fields**" options show What kind of data type used in a field of JSON.

```
$ ctags --output-format=json --list-fields
#LETTER NAME           ENABLED LANGUAGE         JSTYPE FIXED DESCRIPTION
F       input          yes     NONE             s--    no    input file
...
P       pattern        yes     NONE             s-b    no    pattern
...
f       file           yes     NONE             --b    no    File-restricted scoping
...
e       end            no      NONE             -i-    no    end lines of various items
...
```

**JSTYPE** column shows the data types.

**'s'**

string

**'i'**

integer

**'b'**

boolean (true or false)

For an example, the value for **pattern** field of ctags takes a string or a boolean value.

# [VERSIONS](#VERSIONS)

## [Change since "0.0"](#Change_since_)

•

New key **kindName** for **TAG\_ROLE\_DESCRIPTION** pseudo tag

**kindName** is added to store the name of the kind in **TAG\_ROLE\_DESCRIPTION** pseudo tags.

In 0.0, a "TAG\_ROLE\_DESCRIPTION" pseudo tag was printed like:

```
{"_type": "ptag", "name": "TAG_ROLE_DESCRIPTION",


                  "parserName": "LANG!KIND", }
```

In 1.0, it is printed like:

```
{"_type": "ptag", "name": "TAG_ROLE_DESCRIPTION",


                  "parserName": "LANG",


                  "kindName": "KIND",  }
```

# [SEE ALSO](#SEE_ALSO)

[ctags(1)](/man/os/universal-ctags/ctags.1), [tags(5)](/man/os/universal-ctags/tags.5), [ctags-client-tools(7)](/man/os/universal-ctags/ctags-client-tools.7)

1.0

---

Document: ctags-json-output(5) from universal-ctags 6.2.1-r1 (Chainguard OS)
Source: https://github.com/universal-ctags/ctags
