How do I convert a JSON object to a string?
I want to insert a JSON object into a mysql DB.
You might be interested in json_encode().
On the other hand if you already got something json encoded then it already is a string and you can simply store it as-is in the database.
\n instead of new line in my string? I need to json_encode($data) to store to Redis (as string). And later json_decode($string) to get my values from a json..\n "becomes" a linebreak again, see jsfiddle.net/tafodvn5JSON itself is a string. People use json_encode() and json_decode() to convert objects/arrays of PHP to string and back to objects/arrays.