$data[] = $_POST['data'];
$inp = file_get_contents('results.json');
$tempArray = json_decode($inp);
array_push($tempArray, $data);
$jsonData = json_encode($tempArray);
file_put_contents('results.json', $jsonData);
More Related Contents:
- Getting particular object
- How can I parse a JSON file with PHP? [duplicate]
- Returning JSON from a PHP Script
- Reading JSON POST using PHP
- How to POST JSON Data With PHP cURL?
- json_decode returns NULL after webservice call
- Cannot use object of type stdClass as array?
- PHP json_encode encoding numbers as strings
- REST API – why use PUT DELETE POST GET?
- PHP json_decode() returns NULL with valid JSON?
- php json_encode not working on arrays partially
- Send JSON data from Javascript to PHP?
- ByetHost server passing html values “Checking your browser” with JSON String
- Is there any way to convert json to xml in PHP?
- Get a PHP object property that is a number [duplicate]
- how to decode this JSON string?
- Adding subscribers to a list using Mailchimp’s API v3
- jQuery $.ajax request of dataType json will not retrieve data from PHP script
- How to pass an array using PHP & Ajax to Javascript?
- Accessing JSON array after json_decode/multidimensional array
- Find JSON strings in a string
- PHP json_encode json_decode UTF-8
- PHP: How to encode infinity or NaN numbers to JSON?
- How to remove backslash on json_encode() function?
- How do I loop through JSON array
- How to iterate through a nested stdClass? [duplicate]
- PHP: Most frequent value in array
- Json: PHP to JavaScript safe or not?
- Why are escape characters being added to the value of the hidden input
- Read JSON Data Using PHP [duplicate]