# How to change the property of a nested object

**URL:** https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940
**Category:** Questions about Thunkable X
**Created:** [November 18, 2022, 3:36pm UTC](https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940 "2022-11-18T15:36:37Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![rehoboth75](https://avatars.discourse-cdn.com/v4/letter/r/9e8a1a/32.png) [@rehoboth75](https://community.thunkable.com/u/rehoboth75)
#### Post date: [November 18, 2022, 3:36pm UTC](https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940/1 "2022-11-18T15:36:37Z")

</div>

![Nested object blocks](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/c/4c581b06622cfd15627fdb226e098ca4487daa85.png)  
 ![Nested object in an object screenshot](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/d/3d26911c351b9b8dcc99f6679d3d395ae9c88c93.png)  
I am trying to change the value of the property CZT in a nested object. I can’t figure out how to specify the path to this nested property. Can anyone help? Thank you.

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [November 18, 2022, 4:54pm UTC](https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940/2 "2022-11-18T16:54:22Z")

</div>

I can help you but please post the full JSON response as text. That way, I can format it in [https://codebeautify.org/jsonviewer](https://codebeautify.org/jsonviewer) to see the data structure more clearly.

Use the preformatted text button in the forum post toolbar to properly format the text (otherwise, smart quotes can make the JSON appear invalid):

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/a/ea334774dc04c9a89732b2f2bd1069de217314d9.png)

---

<div class="post-metadata">

### Author: ![rehoboth75](https://avatars.discourse-cdn.com/v4/letter/r/9e8a1a/32.png) [@rehoboth75](https://community.thunkable.com/u/rehoboth75)
#### Post date: [November 18, 2022, 5:24pm UTC](https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940/3 "2022-11-18T17:24:31Z")

</div>

Tatiang:  
Here is a link to the project. The question pertains to the Cars Screen.

[https://x.thunkable.com/copy/d90a49fe812c78ac6440c57a7acd6b1c`](https://x.thunkable.com/copy/d90a49fe812c78ac6440c57a7acd6b1c%60)

Here (I hope) is the correct preformated text:

```auto
{"1":{"CZT":"00:00","LegTimeMinutes":0,"critique":"None","headingDegrees":999,"openTime":"00:00","typeWP":"Not yet specified","useCZT":false,"useHeading":false,"useOpenTime":false,"wpLatitude":40.123456,"wpLongitude":-89.123456,"wpPenalty":100},"2":{"CZT":"00:00","LegTimeMinutes":0,"critique":"None","headingDegrees":999,"openTime":"00:00","typeWP":"Not yet specified","useCZT":false,"useHeading":false,"useOpenTime":false,"wpLatitude":40.223456,"wpLongitude":-89.223456,"wpPenalty":100},"3":{"CZT":"00:00","LegTimeMinutes":0,"critique":"None","headingDegrees":999,"openTime":"00:00","typeWP":"Not yet specified","useCZT":false,"useHeading":false,"useOpenTime":false,"wpLatitude":40.323456,"wpLongitude":-89.323456,"wpPenalty":100},"4":{"CZT":"00:00","LegTimeMinutes":0,"critique":"None","headingDegrees":999,"openTime":"00:00","typeWP":"Not yet specified","useCZT":false,"useHeading":false,"useOpenTime":false,"wpLatitude":40.423456,"wpLongitude":-89.423456,"wpPenalty":100},"adminPassword":"","cztOffset":0,"dateOfEvent":"11/17/2022","maxScore":300,"registrationPassword":"abc","timingUnit":"Hundredths","CZT":"10:00"}

```

---

<div class="post-metadata">

### Author: ![rehoboth75](https://avatars.discourse-cdn.com/v4/letter/r/9e8a1a/32.png) [@rehoboth75](https://community.thunkable.com/u/rehoboth75)
#### Post date: [November 18, 2022, 5:27pm UTC](https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940/4 "2022-11-18T17:27:34Z")

</div>

Tatiang,  
I realized that I had not captured the entire object. Here is the entire text.

```auto
{"1":{"CZT":"00:00","LegTimeMinutes":0,"critique":"None","headingDegrees":999,"openTime":"00:00","typeWP":"Not yet specified","useCZT":false,"useHeading":false,"useOpenTime":false,"wpLatitude":40.123456,"wpLongitude":-89.123456,"wpPenalty":100},"2":{"CZT":"00:00","LegTimeMinutes":0,"critique":"None","headingDegrees":999,"openTime":"00:00","typeWP":"Not yet specified","useCZT":false,"useHeading":false,"useOpenTime":false,"wpLatitude":40.223456,"wpLongitude":-89.223456,"wpPenalty":100},"3":{"CZT":"00:00","LegTimeMinutes":0,"critique":"None","headingDegrees":999,"openTime":"00:00","typeWP":"Not yet specified","useCZT":false,"useHeading":false,"useOpenTime":false,"wpLatitude":40.323456,"wpLongitude":-89.323456,"wpPenalty":100},"4":{"CZT":"00:00","LegTimeMinutes":0,"critique":"None","headingDegrees":999,"openTime":"00:00","typeWP":"Not yet specified","useCZT":false,"useHeading":false,"useOpenTime":false,"wpLatitude":40.423456,"wpLongitude":-89.423456,"wpPenalty":100},"adminPassword":"","cztOffset":0,"dateOfEvent":"11/17/2022","maxScore":300,"registrationPassword":"abc","timingUnit":"Hundredths","CZT":"10:00"}

```

---

<div class="post-metadata">

### Author: ![rehoboth75](https://avatars.discourse-cdn.com/v4/letter/r/9e8a1a/32.png) [@rehoboth75](https://community.thunkable.com/u/rehoboth75)
#### Post date: [November 18, 2022, 6:14pm UTC](https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940/5 "2022-11-18T18:14:41Z")

</div>

Tatiang,  
You will see several CZT’s in this object. I’m asking how to change the value of the first CZT in the object.

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [November 18, 2022, 7:06pm UTC](https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940/6 "2022-11-18T19:06:47Z")

</div>

> [@rehoboth75](#):
>
> ```auto
> {"1":{"CZT":"00:00","LegTimeMinutes":0,"critique":"None","headingDegrees":999,"openTime":"00:00","typeWP":"Not yet specified","useCZT":false,"useHeading":false,"useOpenTime":false,"wpLatitude":40.123456,"wpLongitude":-89.123456,"wpPenalty":100},"2":{"CZT":"00:00","LegTimeMinutes":0,"critique":"None","headingDegrees":999,"openTime":"00:00","typeWP":"Not yet specified","useCZT":false,"useHeading":false,"useOpenTime":false,"wpLatitude":40.223456,"wpLongitude":-89.223456,"wpPenalty":100},"3":{"CZT":"00:00","LegTimeMinutes":0,"critique":"None","headingDegrees":999,"openTime":"00:00","typeWP":"Not yet specified","useCZT":false,"useHeading":false,"useOpenTime":false,"wpLatitude":40.323456,"wpLongitude":-89.323456,"wpPenalty":100},"4":{"CZT":"00:00","LegTimeMinutes":0,"critique":"None","headingDegrees":999,"openTime":"00:00","typeWP":"Not yet specified","useCZT":false,"useHeading":false,"useOpenTime":false,"wpLatitude":40.423456,"wpLongitude":-89.423456,"wpPenalty":100},"adminPassword":"","cztOffset":0,"dateOfEvent":"11/17/2022","maxScore":300,"registrationPassword":"abc","timingUnit":"Hundredths","CZT":"10:00"}
> 
> ```

It was not formatted as pre-formatted text so it failed when I tried to format it but I just edited your post to format is properly and now you can paste that same text into [Best JSON Viewer and JSON Beautifier Online](https://codebeautify.org/jsonviewer) to see the data structure:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/d/8dd25738f8bf2ca8cb14f395a89439f2a916127d.png)

When I click on the CZT key, it shows the path to that value at the top (object → 1 → CZT). So in Thunkable, you would set the property “[1].CZT” or set the property “CZT” of the first list item in the object.

I haven’t set JSON properties before so if it were me, I’d make sure I can **get** that key value (“CZT”) before attempting to set it to something else.

You can find out more by watching my tutorial video here: [API JSON Tutorial (Video)](https://community.thunkable.com/t/api-json-tutorial-video/1140575).

---

<div class="post-metadata">

### Author: ![rehoboth75](https://avatars.discourse-cdn.com/v4/letter/r/9e8a1a/32.png) [@rehoboth75](https://community.thunkable.com/u/rehoboth75)
#### Post date: [November 18, 2022, 7:55pm UTC](https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940/7 "2022-11-18T19:55:21Z")

</div>

Do the brackets around the numeral 1 assume that 1, 2, 3, etc are a List? If they are not a list (they are just properties of an object), how would you specify the path to that first CZT? I’ve tried 1.CZT and that didn’t work.

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [November 18, 2022, 7:59pm UTC](https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940/8 "2022-11-18T19:59:19Z")

</div>

Sorry, you’re right, that’s not a list/array. So you’d need to get the property “1.CZT” or you can use two Set/Get property blocks to first get the “1” property of the object and then get the “CZT” property from that.

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [November 18, 2022, 9:22pm UTC](https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940/9 "2022-11-18T21:22:36Z")

</div>

This works for me:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/b/5b92ee74ebed078fb7a41fa2916c4a6fa01f8384.png)

To display this in a label:

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/1/61edb9294d794b92c493885a1d5c5e03e3a3d187.png)

This did **not** work:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/f/1f51257f8a71d12c1f3c06f98c2e5e721aec370e.png)

It still displays 00:00.

But as I said, I don’t have any experience setting properties of objects. I assume that would have to happen at the server level and not internally within Thunkable variables.

---

<div class="post-metadata">

### Author: ![rehoboth75](https://avatars.discourse-cdn.com/v4/letter/r/9e8a1a/32.png) [@rehoboth75](https://community.thunkable.com/u/rehoboth75)
#### Post date: [November 18, 2022, 9:50pm UTC](https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940/10 "2022-11-18T21:50:49Z")

</div>

Tatiang,  
I am able to get/read values from objects. What I haven’t been able to do is to change/store the value of a property in an object. I thought that “SetProperty” block was the proper choice but when I try SetProperty of property 1.CZT of the object, it appends a new property at the end of the object rather than changing the existing property.  
Any suggestions for documentation or tutorial that would illustrate how to change the value of a property of an object?

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [November 18, 2022, 10:48pm UTC](https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940/11 "2022-11-18T22:48:37Z")

</div>

Where are you getting the JSON response from? Are you using an API? Are you hosting the data yourself? Is this from Firebase? Is this from a physical bluetooth device?

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [November 18, 2022, 11:02pm UTC](https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940/12 "2022-11-18T23:02:13Z")

</div>

I didn’t realize you’d included the project link… that’s helpful. But I can’t open it. Is it private?

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/8/a8b772db26722bfc8aced1f27bedba3e55309b2c.png)

---

<div class="post-metadata">

### Author: ![rehoboth75](https://avatars.discourse-cdn.com/v4/letter/r/9e8a1a/32.png) [@rehoboth75](https://community.thunkable.com/u/rehoboth75)
#### Post date: [November 18, 2022, 11:11pm UTC](https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940/13 "2022-11-18T23:11:37Z")

</div>

I am not using an API. I create an object with several nested levels, including a list. This object is then stored on Firebase. This part is working. I then download the Firebase data back to an app object. I am able to read the values in this object and display them on the UI. My difficulty was occurring when I tried to change the value of a property (e.g. change CZT from 00:00 to 10:00).  
Based on your help, I have now been able to accomplish this. Thank you so much for your help. I continue to be impressed with Thunkable.

---

<div class="post-metadata">

### Author: ![rehoboth75](https://avatars.discourse-cdn.com/v4/letter/r/9e8a1a/32.png) [@rehoboth75](https://community.thunkable.com/u/rehoboth75)
#### Post date: [November 18, 2022, 11:16pm UTC](https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940/14 "2022-11-18T23:16:37Z")

</div>

No, it’s a public project.

---

<div class="post-metadata">

### Author: ![rehoboth75](https://avatars.discourse-cdn.com/v4/letter/r/9e8a1a/32.png) [@rehoboth75](https://community.thunkable.com/u/rehoboth75)
#### Post date: [November 18, 2022, 11:20pm UTC](https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940/15 "2022-11-18T23:20:19Z")

</div>

Here is another link to this project. I checked the box agreeing to including passwords and API keys (I don’t believe the project has either of those items).

[https://x.thunkable.com/copy/9ab670f895e9158a49dd6f5d2ed54c2e](https://x.thunkable.com/copy/9ab670f895e9158a49dd6f5d2ed54c2e)

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [November 19, 2022, 2:03am UTC](https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940/16 "2022-11-19T02:03:21Z")

</div>

That one worked.

Since this is Firebase, you should be able to change a nested key’s value by using `set cloud variable [NewEventName's Text]/1/CZT`.

You’ll need to use a Join block to join `NewEventName's text` with the text string “/1/CZT”.

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [November 19, 2022, 2:17pm UTC](https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940/17 "2022-11-19T14:17:18Z")

</div>

@tatiang  
What you did is correct. See my example

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/d/dd3c522313c7bfcce0438b631063570ce17dc850.png)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/e/2e635038daa6db3245e0d5d4cf1200ff75b7e4fa.png)

You cannot use `get object from JSON` to see the update as it will recompile the actual JSON not the updated one.

To go around it you need to  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/c/9c59e00c5e6807850791116f74490407f577ab1f.png)  
and work on the object directly.

Happy Thunking!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)
#### Post date: [February 17, 2023, 2:17pm UTC](https://community.thunkable.com/t/how-to-change-the-property-of-a-nested-object/2137940/18 "2023-02-17T14:17:50Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
