Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Weather App with Swift (Retired) Pulling Data From the Web Review: Network Calls and JSON

Marco Slooten
Marco Slooten
7,899 Points

I can't seem to get the JSON data structures right in the quiz. I'm pretty sure I know the answer but it's not correct.

Even if I quote exactly from the transcript or from JSON.org, when I fill in the blanks it doesn't accept my answer. I'm pretty sure my answer (SPOILER: key-value pairs and ordered lists of values) is correct, but I phrase it wrong causing me to fail the quiz over and over. Or perhaps I'm looking at it totally wrong. I would love some input on this!

2 Answers

I was able to pass the quiz - I'm trying not to spoil the answer. The video explaining this part shows the answer in the form of "definition" - "data-structure". Also, don't pluralize your answers (this may or may not be important; the quiz accepted the singular form of my answers - did not test plural form)

A data-structure representing an ordered list: array

A data-structure representing key/value pairs: ?

Marco Slooten
Marco Slooten
7,899 Points

Thanks a lot! I was a bit confused by the phrasing of the question, I think. Then JSON.org got me confused even more.

With your help I was able to answer it. So simple; should have figured out that one by myself :)

It's asking you for the data-structure.

What data-structure represents key/value pairs?

What data-structure represents ordered lists?

Marco Slooten
Marco Slooten
7,899 Points

Thanks for your reply Robert! If you mean objects and arrays, that's not correct either.

The JSON site (json.org) says the following: "JSON is built on two structures:

  • A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
  • An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence. These are universal data structures. "

So looking at that, it seems the data structures are 'a collection of name/value pairs' and 'an ordered list of values', and these are represented by objects and arrays.

Are you able to pass the quiz?