var high_tide = parsed_json['tide']['tideSummary'][0]['data.type'];
Anybody see why I'm getting undefined when I try to extract the tide type using the code above? I've been trying to figure it out for days so any help would be greatly appreciated!
Thanks!
Anybody see why I'm getting undefined when I try to extract the tide type using the code above? I've been trying to figure it out for days so any help would be greatly appreciated!
Thanks!
- 8 Posts
- 0 Reply Likes
Posted 7 years ago
- 227 Posts
- 43 Reply Likes
What do you expect to get? Value, property, sort of? The code above is outside logic.
- 227 Posts
- 43 Reply Likes
- 227 Posts
- 43 Reply Likes
Double forgive me, but I don't know if I messed with the forum or I am in mess myself.
var high_tide = parsed_json['tide']['tideSummary'][0]['data']['type'];
- 8 Posts
- 0 Reply Likes
One last question...I'm attempting to match the type of tide (high or low) with the corresponding time of day.
I'm using the following code but I'm not sure if I'm on the right track because the time/type matches don't seem right.
var high_tide = parsed_json['tide']['tideSummary'][0]['date']['pretty'];var type = parsed_json['tide']['tideSummary'][0]['data']['type'];
I'm using the following code but I'm not sure if I'm on the right track because the time/type matches don't seem right.
var high_tide = parsed_json['tide']['tideSummary'][0]['date']['pretty'];var type = parsed_json['tide']['tideSummary'][0]['data']['type'];
- 227 Posts
- 43 Reply Likes
the tideSummary struct has a lot of children, so the 0 grabs just the first.
AFAIK, the children are a sort of collection of events, including Low Tide and High Tide but also rising and setting events for moon and sun.
Maybe you nedd to code a cycle around tideSummary to get dates of next low and high tide events.
AFAIK, the children are a sort of collection of events, including Low Tide and High Tide but also rising and setting events for moon and sun.
Maybe you nedd to code a cycle around tideSummary to get dates of next low and high tide events.