Day 74 JavaScript JSON

Truly a fitting description of the year. March madness. Today I looked more into what JSON was. Also I completed Animations II in the grasshopper app.

Using the grasshopper app while learning more about JavaScript is great since its refreshing me on things I’ve learned about. The animations section of the course is using concepts I just blogged about. Concepts using the DOM to manipulate the animation properties. Only difference is that I’m using the DOM to change animations and not getting element by ID/tag. Common animation properties changed were attributes, radius, x axis, y axis, and transition duration.

JavaScript Object Notation(JSON) is a JavaScript format for browser and servers to communicate between. This format allows for better optimization of the data. The main use case seems to be to have the object data in a different file so that the JavaScript file isn’t so sluggish with the amount of data it contains. 

JSON syntax is very similar to object literals. However it is only strings and turns JavaScript objects into string and vice versa. There are two simple functions for using JSON. JSON.parse() parses the data into a JavaScript object. JSON.stringify does the opposite, it converts a JavaScript object to a string. The syntax itself is stricter than JavaScript and requires quotes and commas or it’ll return an error.

JSON is a staple in the space since apps, websites, etc need to pull data from an API. There are many tools to make sure your code is JSON ready such as chrome extension JSON formatters and linters in your IDE to make sure there are no errors in your code. 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Up ↑

%d bloggers like this: