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

151
Views
Guardando la entrada del usuario en el archivo json

Así que tengo una página HTML que le pregunta al usuario el nombre, la descripción y la imagen de una actividad (como un formulario). Quiero crear una función que guarde todas las entradas del usuario en el archivo data.json cuando el usuario hace clic en el botón, pero no sé cómo hacerlo. Aquí la función sobre el botón en js:

 function send() { var nomActi = document.getElementById("nomActi").value; var descriActi = document.getElementById("descriActi").value; var imageActi = document.getElementById("imageActi").value; }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Así es como puede escribir en un archivo json.

fs - módulo para escribirlo en un archivo

 const fs = require('fs'); // create a JSON object const user = { "id": 1, "name": "John Doe", "age": 22 }; // convert JSON object to string const data = JSON.stringify(user); // write JSON string to a file fs.writeFile('user.json', data, (err) => { if (err) { throw err; } console.log("JSON data is saved."); });

about 4 years ago · Juan Pablo Isaza Report
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!