A new Datatype Introduced in mysql which is JSON.

now when I get Raw data from header:
$_data = json_decode(file_get_contents("php://input"),true);
Result of $data
Array
(
[lines] => Array
(
[0] => Array
(
[id] => 8
[name] => Panadol Extra
[qty] => 1
[price] => 11.00
[total] => 11.00
)
[1] => Array
(
[id] => 6
[name] => Panadol Simple
[qty] => 1
[price] => 5.00
[total] => 5.00
)
[2] => Array
(
[id] => 2
[name] => Panadol
[qty] => 1
[price] => 1.00
[total] => 1.00
)
[3] => Array
(
[id] => 1
[name] => Panadol Extra
[qty] => 1
[price] => 1.00
[total] => 1.00
)
)
[discount] => 0
[date] => 2019-11-22T16:31:21+05:00
[paid] => 18
[user_id] => 1
[serial] => 35
)
am getting this error when i store data in mysql
Invalid Query!Invalid JSON text: "Invalid value." at position 0 in value for column 'sales.Invoice'.
here is my query:
require_once 'config/config.php';
$_json = json_decode(file_get_contents("php://input"),true);
echo "<pre>";
print_r($_json);
exit();
$query = "INSERT INTO `sales`
(`UserId`,`invoice`,`Discount`,`Paid`,`Serial`)
Values('','','','','');";
$result = $db->query($query);
if ($result)
echo "Data Inserted Successfully!";
else
echo "Invalid Query!".$db->error;
i need to store discount,paid,user_id,serial and lines(json format) into table.help me to store that data into sales. how do i convert lines into json format. i can store other object discount paid serial using extract function but unbale to convert lines data into json format
php://input) and the error is required to understand what is going awry. Please at least edit the question and show the code that is trying to submit to theInvoicetable.$_dataand creates an insert query.