Trouble with code linking to JSON file in p5.js?

  • The property Sunday points to a JSONObject containing 1 property named hours.
  • Therefore you can’t use numerical-index access for it!
  • Now the internal property hours indeed points to a JSONArray.
  • So you’re right using numerical-index access for that property.
  • Each element in hours is a JSONObject.
  • Seems like you’re particularly interested in accessing the instagram property’s value from each JSONObject element.
  • So I’ve made a demo sketch called “JSON Weekdays Access” & hosted it online.
  • Although you should run it locally or somewhere else in order to view its entire output.
  • That sketch grabs both time & instagram properties and logs them on the page & console grouped by weekdays.

BtW, I’m using the JSON content from my previous answer:

OpenProcessing-UserContent.s3.AmazonaWS.com/files/user22279/visual975186/h4bc21ee7a477aaa173e99631b0328e4d/weekdays.json

1 Like