TLDR, courtesy Douglas Crockford

What you need to know about JSON.

Feargal Walsh
3 min readApr 19, 2018

If it fits on the back of a business card, this blog post shouldn’t be too long right?

I’m going to do my best to not give you that sinking feeling that I get sometimes when I click an attractive headline and start reading a promising intro only to scroll down and realise that the blog post goes on foreeeeeeever without really highlighting what you need to know. If there’s one thing you take from this article it should definitely by the great Douglas Crockford’s business card. But, naturally since it fits on a business card it could use a little more detail in parts.

Value vs. Type

The word value is undoubtedly correct here. JavaScript is,by definition, weakly typed. However, I would argue that since these are all different types that the word type would be more appropriate here. Not to be nitpicky but also very clearly being nitpicky.

However since the other side of the business card is dedicated to breaking down what string and number could consist of, I think it’s fair to say that the types are well explained in such a small real estate. Seriously, I can’t speak highly enough of how impressed I am at Douglas’ (if I may call him that’s) ability to condense a relatively simple but still complex topic into such a digestible format. If more software documentation was written in this way I feel like we would all benefit hugely.

JSON.parse() && JSON.stringify()

These are two methods in JSON that everybody needs to know. JSON objects are returned as strings from API calls. In order to make that string useable in your code you will need to convert it to a JavaScript object using JSON.parse. JSON.stringify essentially does the opposite, that’s all you need to know to get started. Ditch the XML or SQL if you’re using it. JSON is the future, back to front!

Thanks for your attention, it’s the most valuable thing you can give anyone. The hardest thing about writing these posts is often getting started, so any suggestions/requests for topics would be appreciated! I also welcome feedback on previous posts.

If you liked what you have read here and would like to hear more from me please feel free to sign up for my e-mail list on my personal site here, or at the very least…

https://www.youtube.com/watch?v=DdCYMvaUcrA

Resources

https://www.zazzle.com/json_data_interchange_format_business_card-240832802419898189

--

--