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

292
Views
QML using XMLHttpRequest edit JSON file not working

I import a JSON file in my program and I need to read & edit it.

(Only use QML not QT)

Reading part works totally fine , but writing part doesn't.

This is I try to use XMLHttpRequest sending my data to a json file(through qml workerScript)

"qrc:/1122test.json" is the json file's URL in my program

WorkerScript.onMessage = function(message) {
    var xhr = new XMLHttpRequest;
    xhr.open("POST" , "qrc:/1122test.json");
    xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
    xhr.onreadystatechange = function(){
        console.log("1122state" , xhr.readyState);
        if(xhr.readyState == 4){
//            console.log("1122state" , xhr.readyState);
        }
    }
    xhr.send(JSON.stringify({"email":"test@user.com" , "response":{"name" : "newName"}} ));
    console.log("saveed");

}

and my json file example

{
   "email":"hi@user.com" ,
   "response": {
       "name":"tester"
   }
   
}

Every time I open terminal cat the json file , it remain same("hi@user.com" didn't change to "test@user.com" and so was name part)

I already changed the json file's authority to 777

Every log in java showed but not show any error code.

This bother me for over a week , really appreciate any idea !!!

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!