I have a JSON string which is stored in a MYSQL DB. Example:
stdClass Object (
[product] => stdClass Object
(
[sold_individually] =>
[regular_price] =>
[managing_stock] => 1
[sku] => 0001
[title] => Sample title
[reviews_allowed] => 1...
etc.
I have used utf8_encode() to convert it. How can I then turn this in to a PHP array so I can use it?
Edit 1
I have now used json_encode() when posting to the DB. I have also had to use addSlashes() as I was getting some formatting issues with some of the values.
When I now pull in the data it looks like:
"{\"product\": {\"sold_individually\": false, \"regular_price\": \"\", \"managing_stock\": true, \"sku\": \"W-C-6500\", \"title\": \"Sample title\"...
How can I pull out the value for "title"? Should I also use str_replace() to get rid of the \ issue?