I want to know how to add new data in json file array
i am new to json.
want to add data from php or html input.
How can i add forth item of array in json file with php or html input
please help me with example ,
Firstly, I'll just note the JSON you showed isn't valid (it's missing a comma :P), but here is the answer:
You have to load it in.
$data = json_decode($json, true);
($json should be the JSON, and true is to specify to decode as associative array where necessary)
then add your element,
$data = array('id'=>4, 'name'=>'abcdef', 'value'=>'abcdefg');
and then you can recode it as JSON
$json = json_encode($data);