
Json file update using PHP
- or -
Post a project like this1569
$50
- Posted:
- Proposals: 14
- Remote
- #3099581
- Awarded
Senior Developer / Solution Architect / Database Expert / System Integration specialist
430461272425510758721723949504159144642704974887318701471782817425864175381260836



Description
Experience Level: Entry
Hello!
I'm trying to do this for several months without any luck. I have a Json file on my host server that I update from my website. I can delete and edit the array on the file but I cannot insert new data inside the array .
Example: I want to add a new player after "ID: 0" It does insert the new data but after after I put contents back and encoding the original file shows a duplicate. It creates another ID after the new data (a duplicate) and changes all other ids in the file automatically. Everybody says my code is correct but for some reason on my ends does not work properly>
Example: I want to add $list1 with id; "1" after id"0". It works but is adding another id; "2" after automatically.
Why is not working and adding a duplicate? Can someone find an fix my problem? Se codes attached
I'm trying to do this for several months without any luck. I have a Json file on my host server that I update from my website. I can delete and edit the array on the file but I cannot insert new data inside the array .
Example: I want to add a new player after "ID: 0" It does insert the new data but after after I put contents back and encoding the original file shows a duplicate. It creates another ID after the new data (a duplicate) and changes all other ids in the file automatically. Everybody says my code is correct but for some reason on my ends does not work properly>
Example: I want to add $list1 with id; "1" after id"0". It works but is adding another id; "2" after automatically.
Why is not working and adding a duplicate? Can someone find an fix my problem? Se codes attached

Luis P.
100% (4)Projects Completed
3
Freelancers worked with
3
Projects awarded
43%
Last project
18 Aug 2023
United States
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
Hi Luis,
Your end JSON doesn't seem to be normal as it has array of strings which you normally see in PHP, but not in Javascript. I think the confusion could be between associative array in PHP and array in Javascript. I am happy to look into it. Please let me know if you still need help.
Regards,
Shan
962083
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies