Connor Bishop Connor Bishop - 6 months ago 11
JSON Question

Echoing JSON Data in php

Im trying to echo some JSON Data. The problem is the data contains variables but my code isn't putting the variables into the string.
Heres my code:

$status = $row['Status'];
$priority = $row['Priority'];
echo '{"status":"$status","priority":"$priority"}' ;

this php is echoing


when I need to echo


for example. How can I fix this?


Just use json_encode function

echo json_encode($row);