Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

474
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda