> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.emtelligent.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.emtelligent.com/_mcp/server.

# Flatten JSON

The SDK includes a tool for converting a JSON files from the NLP API into a collection of flattened tables in TSV or JSON format.

This tool can be run as `emtellipro-flatten-json`.

## Files produced

A simple example of running the flatten JSON tool is the following:

```bash
emtellipro-flatten-json -O tsv --output ./output/ ./result1.json ./result2.json
```

The output directory must not already exist; the tool will create it for you. If the output directory already exists, you'll get an error.

After running the above command, the output directory will contain the following files.

* The concepts, with headings: `ontology`, `concept_id`, `description`.

```text
concepts.tsv
```

* The assumed entities, with headings: `value`.

```text
entities-assumed.tsv
```

* The found entities, with headings: `sentences_text`, `text`, `section_name`, `polarity`, `uncertainty`, `measurement_unit`, `known_ambiguity`, `question_status`, `guidance`.

```text
entities-found.tsv
```

* The concepts for each found entity, with headings: `sentences_text`, `text`, `concept_id`, `description`.

```text
found-entity-concepts-emtelligent.tsv
found-entity-concepts-medcin.tsv
found-entity-concepts-radlex.tsv
found-entity-concepts-rad_playbook.tsv
found-entity-concepts-rxnorm.tsv
found-entity-concepts-snomed_icd10_cm.tsv
found-entity-concepts-snomed_icd10.tsv
found-entity-concepts-snomed.tsv
found-entity-concepts-umls_hgnc.tsv
found-entity-concepts-umls_loinc.tsv
found-entity-concepts-umls_nci.tsv
```

* Found entity types, with headings: `sentences_text`, `text`, `entity_type_value`.

```text
found-entity-entity-types-emtelligent.tsv
found-entity-entity-types-medcin.tsv
found-entity-entity-types-radlex.tsv
found-entity-entity-types-rad_playbook.tsv
found-entity-entity-types-rxnorm.tsv
found-entity-entity-types-snomed_icd10_cm.tsv
found-entity-entity-types-snomed_icd10.tsv
found-entity-entity-types-snomed.tsv
found-entity-entity-types-umls_hgnc.tsv
found-entity-entity-types-umls_loinc.tsv
found-entity-entity-types-umls_nci.tsv
found-entity-entity-types-umls.tsv
```

* Relations, with headings matching the arguments and attributes for each relation. For example, the experiencer relation contains `polarity`, `experienced`, `experiencer`.

```text
relations-experiencer.tsv
relations-follow-up.tsv
relations-imagelink.tsv
relations-measurement.tsv
relations-medication.tsv
relations-qualifier.tsv
relations-reportedevent.tsv
relations-temporality.tsv
```

* The document sections, with headings: `level`, `name`, `text`.

```text
sections.tsv
```

* The sentences text, with headings: `text`.

```text
sentences.tsv
```

Some command line options include extra headings. See the command line option documentation further down this page.

## Command line tool options

The following is the output of `emtellipro-flatten-json --help`, which returns simple usage information for the tool.

See the [emtellipro-flatten-json command reference](/nlp/python/cli/flatten-json) for all options and arguments.