Read/Write JSON Files with Node.js

preview_player
Показать описание

When you want to store data between server restarts with Node, JSON files are a simple and convenient choice. Whether you are reading a config file or persisting data for your application, Node has some built-in utilities that make it easy to read and write JSON files. Using JSON files in your app can be a useful way to persist data. We will look at a few different methods for working with JSON files.

In this tutorial we'll:
- 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

Рекомендации по теме
Комментарии
Автор

I was searching for json read write whole day then found your
Just 10 min but explained every thing😍

dhruvsanmotra
Автор

An excellent tutorial. And it's exactly what I was looking for as I am about to embark on writing a simple editor for a very specific json file. I will be the sole user and the file is not terribly large, so I am not concerned about multiple users editing the file at the same time. And it's great that you have a written version of this for reference. Thank you!

bobmonsour
Автор

Bro.... What a teaching skill.... Cleared all doubts in single video👍

mohdhussain
Автор

Best tutorial ever.. Keep up the great work!

hatdoggo
Автор

Finally after zapping over 2 tons of inconsistent fs module tutorials, i got he good one ! Damn it

domaincontroller
Автор

Very clearly explained, thanks for the help! I had trouble trying to push a new item into an array in a json document, and this cleared some things up for me

mateonavarrette
Автор

Thank you for the tutorial, it's very informative ))) Please consider using your IDE with a dark theme when making your videos, it's hard to watch this at night 😅

agustinpena
Автор

Hey, just want to thank you for making this video tutorial. Cheers

Cessarini
Автор

Very good tutorial, consice and easy to understand! Thank you so much! 💛

kostiantynkarzhanov
Автор

You explained really clearly. Nice tutorial. Great work!

kentang
Автор

Thanks for the wonderful explanation. Helped me alot.

DirtMankee
Автор

I've been wandering for hours now, looking for JSON read/file help in Node.js (newbie here). Loading JSON faking a web request/response just wasn''t for me and for the project I'm currently on, yet it seemed the only, or at least the "way more popular" way (why in the world? you already possess the *.json file locally... just wondering). I can't really describe how big is my wish to say "Thank you". Thank you for existing, this video is exactly what I needed.

xef
Автор

Thanks amazing tutorial gained a new sub

microfox_hd
Автор

You explained it quite clearly, thank you!

dragunwf
Автор

Very clearly and simply explained. Thankyou.

anitahemrajani
Автор

Nice tutorial, interested to watch you covering other topics too

omarsherif
Автор

Super easy example help nobody in practice

emadroghani
Автор

Very nice.
Please make us learn the same thing in Typescript as well 🙏

pradipspeaks
Автор

very good information. Thanks for sharing.

navajyothiboppidi
Автор

Good video ! (why you use light mode? lmao )

wivon