Home Logic LAMP Stack Blog

Node Project 1: JSON

Step 6: Open JSON

List Files:
candy@cc:~/myFiles$ ls
candy@cc:~/myFiles$ cherry.json fileMaker.js

Now we have 2 files in myFiles:
#1 cherry.json: The file made by fileMaker.js
#2 fileMaker.js: JavaScript file to read and write JSON files.


Open cherry.json with vim:
candy@cc:~/myFiles$ vim cherry.json

You should see:
{"name":"Candy","title":"Commander"}

Step 7: Edit the JSON

Let's edit the JSON by adding another couple object:


    [
    {"name":"Candy","title":"Commander"},
    {"name":"Coral","title":"Commander"},
    {"name":"Max","title":"General"}
    ]
  
vim command:
Type ZZ to save and quit.


YouTube Video | NodeJS File System
YouTube | NodeJS File System Tutorial

Previous Lesson | Next Lesson