I've got a platform that allows users to output selected data into a specific JSON schema. The code is pretty straight forward, and essentially after the SQL query I create an array, start gathering the required information and then populating.
$rowarray['id'] = $orgprefix.'-'.$row['ContractID'];
$rowarray['title'] = $row['Service_Name'];
$rowarray['description'] = $row['Description'];
etc etc
In terms of output, I simply use
echo json_encode($dbdata,JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK);
Anyway, all was working well, until someone mentioned that they were getting totally blank output on one of their budgets. After some serious head scratching, I realised that whenever data from the DB includes a £ sign, the entire process fails.
Now obviously, I can look at options to escape data before adding it to an array, but is there a list of characters I need to be aware of when building JSON data? I was also thinking, is this some sort of encoding issue?