How to use PHP to add data to a specified object in an JSON document

want to know how to add
to the specified object in the document
eg:

after generating a set of json and adding it to the specified sncode.json using file_put_contents.
{"sncode":[
    {"model":"666","sncode":"2333333"},
    {"model":"666","sncode":"1234569"},
    {...}
]}

at present, when I add a new json, it will only be

all the time.
    {"model":"666","sncode":"2333333"},{"model":"666","sncode":"1234569"}    
    {"model":"666","sncode":"1234569"}{"model":"666","sncode":"1234569"}

because the format of json is out of order from the second one, I can"t read the JSON information correctly anyway.

Mar.07,2021

read, decode, add, encode, write


read: $cont = file_get_content ($file);
Decoding: $info = json_decode ($cont, true);
add: $info ['sncode'] [] = [' model'= > '66613'];
Encoding: $json = json_encode ($info);
write: file_put_content ($json);

)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37d96-4ed2f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37d96-4ed2f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?