About the description of JSON

I think the description of JSON is a bit… mistaken. The video says JSON is based on key/value pairs, but that’s not true. Dictionaries in JSON use key/value pairs, as they do in GDScript. But JSON arrays, for example, do not (again, just as in GDScript). In fact, your own example of JSON for your story has an array of dictionaries. The array itself does not have key/value pairs. The contained dictionaries do.

You can have an array like this in JSON:

[ 1, 2, “red fish”, “blue fish”, { “name”: “a struct” }, false]

just as you can in GDScript. The key/value pairs only occur within dictionaries - within the “curlies”.

JSON itself is not based on key/value pairs outside of dictionaries.

In fact, I think the beauty of JSON is how well it maps to the native GDScript types, in terms of even how they’re defined. What you see in GDScript (more or less) is what you would see in JSON.

I hope that helps!

(And not that it matters, but just for the record, I’ve always heard JSON pronounced “Jay-san”, the way someone in Japan would refer to me… Again, not that it matters much. :slight_smile: )

Good catch, Jay San! :smiley:

1 Like

Privacy & Terms