My data is originally JSON, I'm downloading it raw and saving it to database as such:
saveToDatabase( json_encode( $data ) );
The problem, though, is that now the JSON gets encoded twice, since it's originally JSON and I'm, again, encoding it. Thing is, I need an universal answer. This is supposed to be a wrapper over a general-purpose downloader and I can't simply not json_encode everything, because I need to safely save it to the database, but if I do two json_decode
over that saved data, unless it's JSON, it'll break.
How can I solve this paradox?