how to convert json to string

Viewed 112428

how do i convert a json object to a string

i want to insert a json object to a mysql DB

3 Answers

JSON itself is a string. People use json_encode() and json_decode() to convert objects/arrays of PHP to string and back to objects/arrays.

$array = json_decode($json,true); $string = implode(",",$array);

Now you can save this string in db as text.

Related