I prepare the JSON before saving it so it add “” and blackslashses. When I save it, it is adding an addiitonal " on the inside of the square brackets and an /n before the last square bracket.
Figured it out. I needed to use json_decode on the response JSON before I could add the JSON to a new array then encode it before saving to db.
In case it helps anyone.
$json_reponse; // contains json in api response using CURL
$decode_json_response = json_decode($json_response); // now decode it
$update_json = array($decode_json_response); // update the json
$new_json = json_encode($update_json); // encode it
@m_hutley yeah, I supposed that would work too. I actually needed to extract data from the JSON first before encoding it, which was not mentioned in my post. But yeah your approach is easy.