# Read from a nested Json string

**URL:** <https://forum.inductiveautomation.com/t/read-from-a-nested-json-string/96847>\
**Category:** Ignition\
**Tags:** ignition79, vision\
**Created:** [October 4, 2024, 7:55pm UTC](https://forum.inductiveautomation.com/t/read-from-a-nested-json-string/96847 "2024-10-04T19:55:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yidir](https://avatars.discourse-cdn.com/v4/letter/y/35a633/32.png) [@yidir](https://forum.inductiveautomation.com/u/yidir)\
**Post date:** [October 4, 2024, 7:55pm UTC](https://forum.inductiveautomation.com/t/read-from-a-nested-json-string/96847/1 "2024-10-04T19:55:07Z")

</div>

How can I use expressions to read from a nested Json object?  
I wanna read value of key "value".  
{"cid":-1,"data":{"value":0},"code":200}

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [October 4, 2024, 8:38pm UTC](https://forum.inductiveautomation.com/t/read-from-a-nested-json-string/96847/2 "2024-10-04T20:38:44Z")

</div>

Have you tried the `jsonGet` expression function? Your expression would be something like  
`jsonGet("{'cid':-1,'data':{'value':0},'code':200}", "data.value")`

> **[jsonGet | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/JSON/jsonGet)**
>
> Takes a JSON friendly string and a path string, and returns the value of that path.

Edit: fixed `"` vs `'`

---

<div class="post-metadata">

**Author:** ![yidir](https://avatars.discourse-cdn.com/v4/letter/y/35a633/32.png) [@yidir](https://forum.inductiveautomation.com/u/yidir)\
**Post date:** [October 4, 2024, 9:15pm UTC](https://forum.inductiveautomation.com/t/read-from-a-nested-json-string/96847/3 "2024-10-04T21:15:49Z")

</div>

That didn't work unfortunately.

---

<div class="post-metadata">

**Author:** ![yidir](https://avatars.discourse-cdn.com/v4/letter/y/35a633/32.png) [@yidir](https://forum.inductiveautomation.com/u/yidir)\
**Post date:** [October 4, 2024, 9:19pm UTC](https://forum.inductiveautomation.com/t/read-from-a-nested-json-string/96847/4 "2024-10-04T21:19:05Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/6/f62a0d332c834fc8cca70802bcf36cdbc8ef34ab.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/9/99c8e4ead6466ce4b5d60b1ecdad58e2e45b25c4.png)

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [October 4, 2024, 9:19pm UTC](https://forum.inductiveautomation.com/t/read-from-a-nested-json-string/96847/5 "2024-10-04T21:19:33Z")

</div>

Whoops, my example was wrong because the keys are also using `"`, so each key is essentially 'escaping' the string. It should be `jsonGet("{'cid':-1,'data':{'value':0},'code':200}", "data.value")`

Note the weird shading of the json string in your screenshot. The entirety of the json string text should be a purple color.
