0

So i have my json coming back looking like this:

  "full_secnames": {
    "STALLS": "Stalls",
    "CIRCLE": "Circle",
    "P3": "Price Level 3",
    "P2": "Price Level 2",
    "P1": "Price Level 1"
  },

Now i don't know what its gonna come back as "STALLS" or "CIRCLE", Now i thought it would something along the lines of this

for (var i = 0; i < json.full_secnames.length; i++) {

When i do this nothing happens. (no length perhaps via the debugger)

How go about getting the main name of these?

Sam

admitme_sam
  • 159
  • 10
  • JS objects do not have a `.length`. You should instead iterate on the object keys: `Object.keys(json.full_secnames).forEach(function(i) {...})`. – Arnauld Aug 13 '16 at 21:03
  • "You keep using that word. I do not think it means what you think it means." [There is no such thing as a "JSON Object"](http://benalman.com/news/2010/03/theres-no-such-thing-as-a-json/). – Jason Cust Aug 13 '16 at 21:09

0 Answers0