Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

267
Vistas
Add element(Data) to a json file in javascript without node.js

I have done lots of research before I decided to post this question but I still can find a way of adding an element/data to a json file which is stored locally. I have managed to open and read it but not add data. Here is what I would like to happen:

before I run the script.

{"logins" : [

    {        
        "name": "test",
        "usernam": "t",
        "passwor": "ber"
    },

    {
        "name": "test2,
        "usernam": "chi",
        "passwor": "Chik"
    }

]}

and then I really on a button click I would like to add a new element/data so It looks like:

{"logins" : [

    {        
        "name": "test",
        "usernam": "t",
        "passwor": "ber"
    },

    {
        "name": "test2",
        "usernam": "chi",
        "passwor": "Chik"
    },
    {
        "name" : "test3"
        "usernam" : "tester"
        "passwor": "tester2"



]}

and all of this preferably should be done without node.js. I am running this through a script tag in my html

Many thanks.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I assume you have a local .JSON file you are trying to edit with plain JS.

And the answer is no. Without a server, that is practically impossible.

You can however change it client-side, but that'll just be for you, and would never save anywhere else.

This is all for security, because letting a web page change a file... Could also allow it to delete files, including system ones.

Use something simple like Node.js for a backend server that can handle this.

I'd also recommend hashing passwords.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda