Loading

Node.js

Read/Write JSON Files with Node.js. The Complete Node.js Developer Course 2023 [Videos].

Node.js is a platform built on Chromes JavaScript runtime for easily building fast and scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices

  • Read JSON data from disk
  • Learn to use fs module to interact with the filesystem
  • Persist data to a JSON file
  • Use JSON.parse and JSON.stringify to convert data to and from JSON format

By the end of this tutorial you should be able to work with JSON files using Node’s built-in fs module.


Say you have a customer.json file saved to disk that holds a record for a customer in your store.

As part of your store app, you want to access the customers address, and then update the order count after an order is placed.

In this tutorial, we are going to look at how to read and write to our customer.json file.

{
  "name": "Mega Corp.",
  "order_count": 83,
  "address": "Infinity Loop Drive"
}

See All

Comments (125 Comments)

Submit Your Comment

See All Posts

Related Posts

Node.js / Youtube

How to Create Node.js Web Server?

Node.js is a platform built on Chromes JavaScript runtime for easily building fast and scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices
27-jan-2021 /3 /125

Node.js / Youtube

What is Node.js?

Node.js is a platform built on Chromes JavaScript runtime for easily building fast and scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices
27-dec-2020 /3 /125

Node.js / Youtube

Setting up the development environment of Node.js.

Node.js is a platform built on Chromes JavaScript runtime for easily building fast and scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices
9-Jun-2021 /3 /125