Subscribe to Continuations to receive new posts directly to your inbox.
Subscribe to Continuations to receive new posts directly to your inbox.
In today’s Tech Tuesday we are continuing our romp through Data Structures as part of the ongoing series on programming by looking at JSON. Now technically JSON, which stands for JavaScript Object Notation, is not a data structure but a textual notation (as its name implies). But JSON has become ubiquitous and provides a natural segue to objects (next Tuesday) that I figured it makes sense to discuss it here.
Sticking with the example of points, the JSON for a point might look like the following
In this example instead of a single string for a color (“blue”) as before, I am showing how JSON lets us describe levels of nesting. The red, green and blue are sub-attributes of the color attribute.
How would we actually use this JSON? In modern implementations of JavaScript, we can make a direct assignment of JSON to a variable as follows: