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

263
Views
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 answers
Answer question

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 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!