0

Problem

I'm trying to grab data from the console, which comes from an API about river levels, however, one of the columns has spaces as opposed to underscores or camel-casing and I'm unsure how to grab it.

I've tried adding underscores, lowercasing, changing it into a string, but that hasn't seemed to work.

Documentation: http://opengov.brandon.ca/api.aspx

Console

Object {Date: "22/05/2015 9:31:19 AM", River Level (ft): "1169.81000", River Level (m): "356.55809"}
Community
  • 1
  • 1
Andrew Nguyen
  • 1,416
  • 4
  • 21
  • 43

1 Answers1

1

Use the array notation:

yourObject["River Level (ft)"]

See it here:

var obj = {
  "Date": "22/05/2015 9:31:19 AM", 
  "River Level (ft)": "1169.81000", 
  "River Level (m)": "356.55809"
}

alert(obj["River Level (ft)"]);
Shomz
  • 37,421
  • 4
  • 57
  • 85