• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar
  • Home
  • About
  • What is This?

๐Ÿ“šThe Avid Bookreader

"I am Still Learning" - Michelangelo

  • Paid Newsletter
  • 1% Smarter
  • Avid Weekly Ideas
You are here: Home / Technology / 1% Smarter #10 – What the heck is JSON? And how you can represent almost any object with it

1% Smarter #10 – What the heck is JSON? And how you can represent almost any object with it

March 3, 2019 By theavidbookreader Leave a Comment

What is 1% Smarter?

This series is based on the concept of continuous improvement and compounding gains which have their roots in the fields of manufacturing and finance respectively. ๐Ÿ“š

My goal for 1% Smarter is to apply these concepts to learning. Keep making 1% improvements and before you know it you’ll have made a significant improvement in your life. ๐Ÿ’ช


Rewind just a few months back and you could call me tech illiterate.

As some of you may know by now, one of my goals for 2019 is to graduate from tech illiteracy and at least advance to become a tech novice ๐Ÿ˜€

Why learn tech?

Well I don’t think I really need to say too much about this.

There are many reasons and they are well documented but I’ll name you a few of my main motivations.

  1. A genuine interest and curiosity of how technology works – we live in magical times. Imagine if you brought a man from just 100 years ago and time-transported-him-Back-to-the-Future-Style to today he would be awestruck at the sights he would be seeing so much so that he would be paralyzed by shock because we would all seem like sorcerers to him. As Arthur C. Clarke once famously remarked, “Any sufficiently advanced technology is indistinguishable from magic.”
  2. Future-proof my career and stay relevant
  3. Make me a better problem solver
  4. Related to #1 – endeavor to stay above the API
  5. Gain the ability to build side projects – as Paul Graham aptly puts it, ideas are worth nothing without the ability to execute. Paul goes as far as to say that ideas have $0 value, and the proof of this is if they had any value whatsoever there would be a marketplace for ideas. But as we know there are none. Learning tech, specifically programming skills gives you the ability to execute.
  6. Enhance my creativity
  7. Gain the ability to automate just about most things – I read a really cool book on this topic by Al Sweigart called Automate the Boring Stuff With Python: Practical Programming for Total Beginners. Imagine if you could automate all the mundane stuff that you do daily? That would kind of be like having a little army of minions or bots at your disposal!

Alright, so what the heck is JSON?

Yep until recently that was what I was thinking too. I had no idea.

This is one of those cases where the Wikipedia definition does more harm than good!

In computing, JavaScript Object Notation (JSON) is an open-standard file format that uses human-readable text to transmit data objects consisting of attributeโ€“value pairs and array data types (or any other serializable value). It is a very common data format used for asynchronous browserโ€“server communication, including as a replacement for XML in some AJAX-style systems.

JSON is a language-independent data format. It was derived from JavaScript, but as of 2017 many programming languages include code to generate and parse JSON-format data. The official Internet media type for JSON is application/json. JSON filenames use the extension .json.

Okay…now that was a mouthful…

If, like me, after reading that you still have no idea what it is (you might even be more confused now) – have no fear!

JSON in 7 minutes

Here is what I’ve learned and let me try to explain it in seven main dot points:

  • JSON is simply a type of data structure
  • JSON heavily utilizes key-value pairs. A key-value pair is simply like one of those forms you’ve filled out since you were a kid. For example:
    • Name: Jack
    • Age: 21
    • Gender: Male
    • Date of birth: 10/10/1980
    • You get the point. In each case above, the key is on the left and the value is on the right.
    • See sample below ๐Ÿ‘‡
Sample JSON user data.
  • Why learn JSON? Along with XML, JSON is one of the most popular and common data formats when it comes to web and API development. Many modern APIs will return you JSON when you request data from them.
  • JSON is easy to read – if you can read a form, you can probably read JSON. As opposed to it’s verbose counterpart XML, JSON is much easier to read. Have a look at a comparison. Note that they are both representing the same thing, a group of three employees.
 
Photo credit to Sunny Hoi.
  • Finally, this really helped make it stick for me. You can use JSON to represent just about any object. This is a form of abstraction. Of modeling the real world, which is a core concept in computing, which is really in large part about modeling the physical world into digital form. Think about anything you might use daily and they can be modeled (and probably have already been) in the digital world.
    • Library books
      • For example:
      • Title: The Lord of the Rings
      • Author: J. R. R. Tolkien
      • Language: English
      • Publisher: Allen & Unwin
      • Published: 29 July 1954
      • Genre: Fantasy
    • Credit cards
      • For example:
      • Card Number: 378282246310005
      • Cardholder Name: John Citizen
      • Expiry: 10/2021
      • CVV: 123
      • Type: Visa
      • Issuer Bank: Bank of America
    • Products on Amazon
      • For example:
      • Product Name: Nike Womenโ€™s Air Zoom Pegasus 35 Running Shoes
      • Price: $75
      • Customer Reviews: 70
      • Average Rating: 4.5 stars
      • Product description: The nike air zoom pegasus 35 women’s running shoe has been redesigned to be incredibly snappy, both in appearance and performance. The full-length zoom air unit and the bevelled heel work in synergy to achieve excellent responsiveness, while the engineered mesh and flywire cables ensure maximum stability in acceleration.
      • Shipping Weight: 12 ounces
      • ASIN: B07CXGMVJL
    • Food
      • For example:
      • Name: McChicken
      • Calories: 272
      • Total Fat: 13 g
      • Cholesterol: 27 mg
      • Sodium: 624 mg
      • Potassium: 173 mg
      • Protein: 10g
    • Cars
      • For example:
      • Name: Tesla Model S
      • Price: $100,000
      • Manufacturer: Tesla, Inc.
      • Designer: Franz von Holzhausen
      • Battery: 100 kWh lithium ion
      • Transmission: 1-speed fixed gear (9.73:1)
      • Length: 195.9 in (4,980 mm)
      • Width: 77.3 in (1,964 mm)
      • Height: 56.5 in (1,440 mm)
    • Animal species
      • For example:
      • Name: Lion
      • Species: Panthera leo
      • Kingdom: Animalia
      • Class: Mammalia
      • Order: Carnivora
      • Suborder: Feliformia
      • Family: Felidae
      • Genus: Panthera
      • Movie: The Lion King ๐Ÿ˜‰
    • …and on and on the list can go…I am sure you get the point by now. You can model just about anything in JSON.
  • JSON makes it easy for developers to access the data they want. Going back to our user example from above. If you wanted to access specific fields in the user object you could easily do the following:
    • If you want the user’s first name -> you can do user.firstName and that will return you “John”
    • If you want the user’s last name -> you can do user.lastName and that will return you “Smith”
    • So basically you just provide the name of the key and you will be returned the value associated with the key
  • JSON is often used together with a programming construct called a loop – let’s say we had a list of 100 users and you wanted to print out all their names you could write a simple loop that in English would roughly translate to the following:
    • For each user in our list or array, print out user.firstName + user.lastName which will join (concatenate) their first and last names together. In other words “John” + “Smith” = “John Smith”
    • A loop is a way that you can make a computer repeat a series of steps as many times as you want. This is very handy because that is where computers excel against humans – in performing highly repetitive tasks with precision.

Extra Reading/Resources

Here are some extra reading/resources if you wanted to find out more about JSON.

  1. JSON Crash Course (video)
  2. JSON explained in less than 10 minutes (video)
  3. Introduction to JavaScript Object Notation: A To-the-Point Guide to JSON (book – Kindle or Paperback)

As always,

๐Ÿ“š Happy Reading


Thanks for reading. If you enjoy my publication and would like to support it, there are a couple of ways you could do that.

  • The easiest way is to share these posts with whoever you think would find them interesting. My goal with 1% Smarter is to help people develop a continuous learning habit. So feel free to forward them on to your friends or family. โœ‰
  • If you have the means you could subscribe to my paid Substack publication. It would go a long way towards helping me devote more time towards my pursuit of lifelong learning and enable me to create more content. ๐Ÿ“š

Either way, I really appreciate the time you spent reading this article. ๐Ÿ™


Thanks for reading. If you enjoy my publication and would like to support it, there are a couple of ways you could do that.

  • The easiest way is to share these posts with whoever you think would find them interesting. My goal with 1% Smarter is to help people develop a continuous learning habit. So feel free to forward them on to your friends or family. โœ‰
  • If you have the means you could subscribe to my paid Substack publication. It would go a long way towards helping me devote more time towards my pursuit of lifelong learning and enable me to create more content. ๐Ÿ“š

Either way, I really appreciate the time you spent reading this article. ๐Ÿ™


Letโ€™s stay in touch. You can find me on:

Twitter | The Avid Bookreader Substack | Instagram

Spread the love of learning!

Filed Under: 1% Smarter, Technology Tagged With: Al Sweigart, Arthur C. Clarke, Paul Graham

๐Ÿ“• Did you enjoy this? โค๏ธ

Then why not subscribe to The Avid Bookreader and have new posts emailed to you?

So you won’t miss a thing.

It’s free and you can unsubscribe whenever you want.

Reader Interactions

Related

Leave a Reply Cancel reply

Primary Sidebar

Send me new posts โœ‰

Say Hello On

  • Email
  • Instagram
  • Twitter

What are you looking for?

Recent Posts

  • Avid Weekly Ideas #13 – 12 Tips on Building Wealth – from the Angel Philosopher
  • Avid Weekly Ideas #12 – How to Build Better Habits
  • Avid Weekly Ideas #11 – Tiny Habits Make a Big Difference
  • Avid Weekly Ideas #10 – The Energy Metric
  • Avid Weekly Ideas #9 – 7 Lessons from a Roman Emperor

Recent Comments

  • theavidbookreader on Hello World! Welcome to The Avid Bookreader~
  • A WordPress Commenter on Hello World! Welcome to The Avid Bookreader~

Archives

  • October 2020 (1)
  • September 2020 (4)
  • August 2020 (9)
  • July 2020 (5)
  • June 2020 (1)
  • October 2019 (1)
  • April 2019 (1)
  • March 2019 (1)
  • February 2019 (3)
  • January 2019 (9)

Categories

  • 1% Smarter
  • Ancient Wisdom
  • Avid Weekly Ideas
  • Being More Effective
  • Building Wealth
  • Business
  • Effective Decision Making
  • Health & Fitness
  • Mental Models
  • Mindset
  • My Booknotes
  • People Skills
  • Pondering Life
  • Presenting Your Best Self
  • Productivity Hacks
  • Putting Things into Perspective
  • Technology
  • The Art of Learning
  • The Avid Bookreader Updates & News
  • The Marvels of the Human Body
  • The Wonders of Science

Tags

Al Sweigart (1) Arianna Huffington (1) Arthur C. Clarke (2) Bible (7) Bill Bryson (1) Bill Gates (1) Brian Christian (1) Charlie Munger (1) Chris Guillebeau (1) Elon Musk (1) Eric Jorgenson (1) Gary Keller (2) Hippocrates (1) J.D. Meier (1) J.R.R. Tolkien (1) James Clear (3) Jason Fried (1) Jordan Peterson (1) Malcolm Gladwell (1) Marcus Aurelius (1) Marie Kondo (2) Mark Suster (1) Matthew Walker (1) Michael Pollan (1) Naval Ravikant (2) Paul Graham (1) Peter Drucker (1) Ray Dalio (4) Richard Evan Schwartz (1) Robin Li (1) Roger Love (1) Scott Adams (1) Scott Galloway (1) Stephen Covey (1) Steve Jobs (1) Tim Ferriss (2) Tom Griffiths (1) Tony Robbins (1) Warren Buffett (2)

Copyright © 2021 · The Avid Bookreader · by N.H. Lee · Powered by Genesis Framework

 

This site directs people to Amazon and is an Amazon Associate member.