nathanbweb
nathanbweb

Reputation: 717

YQL returning table of undefined values, even though JSON object has contents

I'm using Google Docs and YQL to power a job postings board. I got one version up and running at

http://jsfiddle.net/N4Hb8/8/ .

Then I modified the YQL query to only get jobs listed as "open", which returns this JSON object:

http://bit.ly/i0phfc

But the resulting table is full of "undefined"'s.

http://jsfiddle.net/N4Hb8/10/

What went wrong?

Upvotes: 0

Views: 177

Answers (1)

NT3RP
NT3RP

Reputation: 15370

What appears to have gone wrong is that in your first example, item is an actual object, whereas in your second example, item actually refers to the columns you want. If you console.log(item) you'll see what I mean.

More specifically, it appears that in your first example, it happens to return an array of results. In your second example, it returns a single result.

To fix your code, you'll need to handle the special case that you're returned only one item.

Upvotes: 1

Related Questions