JSON, A Brief Explanation: Day Five of "The Complete Node.js Developer Course"

in #javascript7 years ago

photo4994570911529150400.jpg

JSON (JavaScript Object Notation)

It's a way to store data in an object, using the Javascript way of writing and accessing that data. I've worked with JSON before in the programming courses that I've taken. This is the first time that I've written that data to a file and then read it again from that file.

Persistent data storage!

That's my goal. To build apps are able to store data. More than just front-end apps. I want to be able to write my own data or the data of other users.

Previously

Okay, back to JSON

This course really didn't explain much about JSON. The course just had me write some JSON data, convert it to a string, write that string to a file. After that, I wrote code to read the contents of that file, convert the string back to an object and then access a value of that object with dot notation. Here's a screenshot of the code:

Screenshot from 2017-09-01 19-53-44.png

Now here's the output when I run the app from the terminal:

Screenshot from 2017-09-01 19-54-18.png

For today, I just had time to go through the exercise in section 15. Working With JSON. I was able to write it without any errors the first time and it worked as expected. For my own learning, I'm often pausing the video, guessing what he'll present next and then doing what I've guessed. Then I play the video and see if I'm right. I almost always am, so that means that I have a good understanding of what's going on. It may also indicate that the course is logically presented well.

Building Blocks

I can see how this is the start of what I'm looking to do. I hope to make some time soon to experiment with the concepts I've learned and build some of my own things. I find that I like to prove that I understand what is going on by coming up with an idea of my own and then building it with the coding concepts that I know.

Right now things are fairly basic, but I need to have a solid understanding of the basics to build upon. So far, so good.

Thanks for reading!

--- @matthewdavid

Sort:  

What a good job you're doing here.

Right now things are fairly basic, but I need to have a solid understanding of the basics to build upon.

You'll find out that even when you're writing very complex programs, they will be only a huge amount of basic instructions, so learning the basics and mastering them is what you need to do.

Thanks Julio for the advice and encouragement. It's good to hear that the things I'm learning now will continue to be useful.

I'm enjoying the learning process, but very much looking forward to being able to build the apps I've been wanting to make for myself, my family and others.

A great vid on javascript and the bits of the language that are best to use by Doug Crockford

(JavaScript: The Good Parts)[

]

Thanks Woz,

I really like, in this video, when Doug says "Javascript is basically Scheme with C syntax". A long time ago, I read Hackers and Painters by Paul Graham and that got me interested in Scheme and Lisp. Unfortunately, I didn't push myself to really understand what was going on and I didn't "become a programmer" at that time.

Now, I do consider myself a programmer and I believe it is from being able to easily implement and test the the things I'm learning with Javascript in the browser (and now on the server and file system with node.js).

Javascript's accessibility has made it much easier for me to learn, and remember, programmatic concepts.

Yep, far faster turn around in something like JS. It is also becoming the de facto language almost anywhere. Just a shame they did not remove some of the "crap" in later revisions of the language.

It is a shame that too many think of JS as an OO language when it is really not. As the bit you highlighted, scheme with C syntax. When used OO it is awful but use as intended and can be really clean.

I still prefer the safety net of strong type checking personally but that is my background and the languages I grew up on.

So many languages compile down to JS also, there is even a C# to JS compiler.

The language I hope really grows client side is Elm. Pure functional stack based on ML. It is the language that inspired the React stack in JS that is gaining traction.

In the end it does not matter the language you learn, just that you learn from the mistakes you make on the way. But do learn other languages that are very different after you are comfortable with the first one. Each will teach you new ways of thinking about flow and data. This is why I am learning functional and F#. I is teaching me to think like a mathematician instead of a programmer. I will probably never work in it, too few jobs, but I love the mental spaces code takes me hence the never ending drive to learn :)

Coin Marketplace

STEEM 0.18
TRX 0.13
JST 0.028
BTC 57367.79
ETH 3098.11
USDT 1.00
SBD 2.32