# Code not working in p5.js with JSON data?

**URL:** <https://discourse.processing.org/t/code-not-working-in-p5-js-with-json-data/24152>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [September 27, 2020, 2:00pm UTC](https://discourse.processing.org/t/code-not-working-in-p5-js-with-json-data/24152 "2020-09-27T14:00:14Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [September 27, 2020, 2:30pm UTC](https://discourse.processing.org/t/code-not-working-in-p5-js-with-json-data/24152/2 "2020-09-27T14:30:04Z")

</div>

> [@sam101](#):
>
> `data.oneam.instagram`

As I had already explained on your previous topic:

> [@How do I draw a circle based on my JSON data information in p5.js?](https://discourse.processing.org/t/how-do-i-draw-a-circle-based-on-my-json-data-information-in-p5-js/24146/2):
>
> [Discourse.Processing.org/faq#format-your-code](http://Discourse.Processing.org/faq#format-your-code) [{ "12:00 am": { "instagram": 0, "messenger": 0, "snapchat": 0, "email": 0, "facebook": 0, "totalNotification": 0 } }, { "1:00 am": { "instagram": 1, "messenger": 2, "snapchat": 0, "email": 0, "facebook": 0, "totalNotification": 3 } }] Given the JSON file is initially wrapped up w/ square brackets [] it means its outer datatype is JSONArray. And you…

Your JSON file is a JSONArray of 2 JSONObject entries.

So you 1st need to specify the indexed entry number in order to access 1 of those JSONObject objects:  
`data[1].oneam.instagram` or `data[1]['oneam']['instagram']`

---

_[View the full topic](https://discourse.processing.org/t/code-not-working-in-p5-js-with-json-data/24152)._
