# \[Solved\] Need Help Decoding a JSON Response

**URL:** <https://community.thunkable.com/t/solved-need-help-decoding-a-json-response/75609>\
**Category:** Questions about Thunkable X\
**Tags:** solved\
**Created:** [April 30, 2019, 9:32pm UTC](https://community.thunkable.com/t/solved-need-help-decoding-a-json-response/75609 "2019-04-30T21:32:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Charles\_Casteel](https://avatars.discourse-cdn.com/v4/letter/c/a88e57/32.png) [@Charles\_Casteel](https://community.thunkable.com/u/Charles_Casteel)\
**Post date:** [April 30, 2019, 9:32pm UTC](https://community.thunkable.com/t/solved-need-help-decoding-a-json-response/75609/1 "2019-04-30T21:32:14Z")

</div>

Ineed some help with decoding json responses from TicketMaster for an event search querry.

How do I display the event name, venue name, etc.? I am new at this and I am not an expert.

What I want my app to do is to list events for a particular classification name, city, state, and start date and display the response

with the event name, date, time, venue, city and state.

My api query is responding with the json however I don’t know how to decode and dipsplay the fileds that I want.

The json begins with \_embedded, then events, then name, type, id, etc. (See attached powerpoint) If I display name, I get and undefined error.

Then I tried event, name and I get a blank screen no errors,

I am using the Thunkable X app sdk and the attached powerpoint shows how I am trying how to do it.

Thanks

Charles

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

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

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

---

<div class="post-metadata">

**Author:** ![Cian\_O\_Sullivan](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/cian_o_sullivan/32/34494_2.png) [@Cian\_O\_Sullivan](https://community.thunkable.com/u/Cian_O_Sullivan)\
**Post date:** [April 30, 2019, 11:02pm UTC](https://community.thunkable.com/t/solved-need-help-decoding-a-json-response/75609/2 "2019-04-30T23:02:53Z")

</div>

Can you give me a URL you are using to get the JSON and I can take a look

You can PM me if it has a secret API.

---

<div class="post-metadata">

**Author:** ![Mark](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mark/32/18133_2.png) [@Mark](https://community.thunkable.com/u/Mark)\
**Post date:** [April 30, 2019, 11:34pm UTC](https://community.thunkable.com/t/solved-need-help-decoding-a-json-response/75609/3 "2019-04-30T23:34:23Z")

</div>

@Charles_Casteel, The key here is understanding a little bit about the way that JSON text represents lists and objects. When you see something that begins with a `'{'` ( for example `'{ _embedded: { events: ... '` ) that means that that the JSON text represents an object. When you see something that begins with a `'['` ( for example `'... [ { name: "Adam Sandler", ...'` ) then that represents a list. It get a little more complicated, of course, because objects can contain lists within them and lists can contain objects within them.

In your case, we can see that the JSON returned by the Ticketmaster API call here represents an object with a property named `"_embedded"`. The value of that `"_embedded"` property is an object which in turn contains a property called `"events"`. The value of that `"events"` property is a list of objects representing a single event, and each of those objects has properties named `"name", "type", "id", ...` and interestingly `"_embedded"`.

The value of that inner `"embedded"` property (which is contained in each object in the `"events"` list) is an object which has a `"venues"` property, whose value is a list. Each venue object in that list has a `"name", "city" and "state"` property (among others). The `"city"` property has as its value an object with a `"name"` property and the `"state"` property has as its value an object with a `"name"` property and a `"stateCode"` property.

Knowing all the above, [here is a link](https://x.thunkable.com/copy/71090841415051726c4e854cd3e8e598) to a shared example project that will display the name and city of the 2nd event. And here is a screenshot of the blocks from that project

 ![59%20PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/e/5ebcc64765a7d16f64d8f45a3f4d1e04d99e0ac0.png)

Note that I have set the Ticketmaster URL property in the Web API property in the designer. That URL contains an API key and I’m not sure how long that key will be valid. If the app doesn’t work for you, you may need to replace the portion of that URL that contains the API key.

I hope this helps!

-Mark

---

<div class="post-metadata">

**Author:** ![Charles\_Casteel](https://avatars.discourse-cdn.com/v4/letter/c/a88e57/32.png) [@Charles\_Casteel](https://community.thunkable.com/u/Charles_Casteel)\
**Post date:** [May 2, 2019, 5:42pm UTC](https://community.thunkable.com/t/solved-need-help-decoding-a-json-response/75609/4 "2019-05-02T17:42:16Z")

</div>

Thank you for getting back to me. I was able to get the json fields for everything, i.e. name, venue, city and state for a particular event. GREAT!!!.

Now, I need help to list all of the events by name based on some filter.

I have attached my blocks. However, I get no results. Yes, the Ticketmaster api is retruning the json.

Thanks,

Charles

 ![ListOfEventsBlocks](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/8/582f7b02ba3ece0c6114cfb0d9a152ece475989e.png)

---

<div class="post-metadata">

**Author:** ![ubaldo.chantaca6](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ubaldo.chantaca6/32/72487_2.png) [@ubaldo.chantaca6](https://community.thunkable.com/u/ubaldo.chantaca6)\
**Post date:** [June 12, 2020, 9:49pm UTC](https://community.thunkable.com/t/solved-need-help-decoding-a-json-response/75609/5 "2020-06-12T21:49:34Z")

</div>

I have the same problem, How do you solve this issue?

---

<div class="post-metadata">

**Author:** ![topniz](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/topniz/32/77500_2.png) [@topniz](https://community.thunkable.com/u/topniz)\
**Post date:** [July 25, 2020, 5:27am UTC](https://community.thunkable.com/t/solved-need-help-decoding-a-json-response/75609/6 "2020-07-25T05:27:54Z")

</div>

Very late answer, but may be useful for others.  
Many issues with your blocks:

1. Your _TMResponse_ is not yet a list. It is an object with 3 properties : “\_embedded”, “\_links” and “page”
2. In the first “FOR” loop, you update _TMevents_ with the current item “j”, and not inserting it as a new item in the _TMevents_
3. The current item in the “FOR” loop, here named “j”, is not an index, but the complete item. In our case, it is a full event JSON object
4. Same for the second “FOR” loop: You dig in _TMevents_ to extract events’ names and you update _TMname_ with the current “j” item

So the solution to your problem is the following:

 ![listEventsBlock](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/6/b6620a246e8b541be3c33d4f3acc6d6ef5d55df1.png)

Remark: The “IF” block inside the “FOR” loop is only to select unique values in the events’ names list, but you can omit it if you want all names, even duplicate ones.

**Info** : by the way, thank you for the ticketmaster API 😉

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 11:27am UTC](https://community.thunkable.com/t/solved-need-help-decoding-a-json-response/75609/7 "2024-11-08T11:27:05Z")

</div>


