# Parsing a json file for specifying the terminology for segment editor

**URL:** <https://discourse.slicer.org/t/parsing-a-json-file-for-specifying-the-terminology-for-segment-editor/30505>\
**Category:** Support\
**Created:** [July 10, 2023, 11:16pm UTC](https://discourse.slicer.org/t/parsing-a-json-file-for-specifying-the-terminology-for-segment-editor/30505 "2023-07-10T23:16:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DeepaKrishnaswamy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/deepakrishnaswamy/32/8913_2.png) [@DeepaKrishnaswamy](https://discourse.slicer.org/u/DeepaKrishnaswamy)\
**Post date:** [July 10, 2023, 11:16pm UTC](https://discourse.slicer.org/t/parsing-a-json-file-for-specifying-the-terminology-for-segment-editor/30505/1 "2023-07-10T23:16:02Z")

</div>

Hi,

I have a json file that contains the necessary information for specifying the terminology for the segment editor, similar to [this](https://github.com/QIICR/dcmqi/blob/master/doc/schemas/segment-context-schema.json).

To use this file, I see that I can do something like:  
`terminologyFile = path_to_json_file`  
`tlogic = slicer.modules.terminologies.logic()`  
`terminologyName = tlogic.LoadTerminologyFromFile(terminologyFile)`

However, if I have a different json file that contains the terminology specification as well as other additional fields, I cannot use the above method. Has anyone tried to parse and set the terminology correctly in this case?

So far I have tried using `tlogic.DeserializeTerminologyEntry`, but I encounter errors in failing to get the terminology category.

Thank you,

Deepa

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/83011_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [July 11, 2023, 6:19am UTC](https://discourse.slicer.org/t/parsing-a-json-file-for-specifying-the-terminology-for-segment-editor/30505/2 "2023-07-11T06:19:17Z")

</div>

you may want to check whether your JSON file is valid using this tool.

[https://qiicr.org/dcmqi/#/validators](https://qiicr.org/dcmqi/#/validators)

---

<div class="post-metadata">

**Author:** ![DeepaKrishnaswamy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/deepakrishnaswamy/32/8913_2.png) [@DeepaKrishnaswamy](https://discourse.slicer.org/u/DeepaKrishnaswamy)\
**Post date:** [July 11, 2023, 3:24pm UTC](https://discourse.slicer.org/t/parsing-a-json-file-for-specifying-the-terminology-for-segment-editor/30505/3 "2023-07-11T15:24:05Z")

</div>

Sorry, perhaps I didn’t explain it properly.

My original json file is valid, here is a snippet:

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/5/55b2b30068d0723bca9bacbb00c42578b53da459.png)

However the new json file I am creating contains the fields for the terminology along with extra fields required for the extension I’m working on. For instance, something like this.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/6/269f739a2bff65b55ae24b627e256b4b918b1b95.png)

Therefore, I need to parse this new json file to set up the terminology appropriately.

Thank you,

Deepa
