Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

472
Views
How to manipulate local JSON file using JavaScript on the client side?

Context

A feature that I would like to implement is to add a local(client side) database as offline feature for my cordova app using basic html, css, and js. It would be a fallback in case the internet connection is cut off. What I thought was that it would store the request url and request data inside a local JSON file and would have an option later on to be able to resend those failed request if the internet connection is restored.

Question

Is there a method to manipulate (add/create, edit/update, and delete) a JSON file stored inside a client app using pure JS?

What I've done so far is import and read a JSON file inside my app folder using the following code:

fetch("./database.json")
  .then((response) => {
    return response.json();
  })
  .then((data) => console.log(data));

(if there's a better way to do it, feel free to give a feedback in the comments)

That works fine and all, but I can't find any method on how to add/edit/delete an object and save the changes to that same JSON file.

According to this post which is half a decade ago, it is not possible without doing it in the backend.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!