Below is my JSON format string:
a:1:{i:0;a:10:{s:2:"id";s:4:"2086";s:12:"variation_id";s:4:"2091";s:4:"name";s:10:"VELCRO BIB";s:3:"qty";s:1:"1";s:9:"item_meta";a:2:{i:0;a:2:{s:9:"meta_name";s:4:"Size";s:10:"meta_value";s:10:"0-3 MONTHS";}i:1;a:2:{s:9:"meta_name";s:5:"Color";s:10:"meta_value";s:6:"BEIGE1";}}s:13:"line_subtotal";s:3:"108";s:17:"line_subtotal_tax";s:1:"0";s:10:"line_total";s:3:"108";s:8:"line_tax";s:1:"0";s:9:"tax_class";s:0:"";}}
How can i convert it to readable format or in php array format?
I'm using json_decode function however it doesn't return anything.
Earliest help appreciated.
asked Oct 9, 2012 at 6:31
Aditya P Bhatt
22.2k20 gold badges88 silver badges105 bronze badges
-
1This isn't JSON? You'll probably have to write a decoder yourself for this format.Denys Séguret– Denys Séguret2012年10月09日 06:32:48 +00:00Commented Oct 9, 2012 at 6:32
-
3That looks like serialized PHP.tomsseisums– tomsseisums2012年10月09日 06:33:50 +00:00Commented Oct 9, 2012 at 6:33
-
oh, thanks for all yr quick answers :)Aditya P Bhatt– Aditya P Bhatt2012年10月09日 06:41:40 +00:00Commented Oct 9, 2012 at 6:41
2 Answers 2
That is a serialized php value, not JSON. use unserialize to convert it back to its original value.
answered Oct 9, 2012 at 6:34
Musa
97.9k17 gold badges123 silver badges144 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
This string is malformed. json_decode is correct. You have to make a correct JSON string and then it should work. If you want to know how a correct JSON string has to be, look at this site: http://www.json.org/
answered Oct 9, 2012 at 6:32
FrediWeber
1,0991 gold badge10 silver badges21 bronze badges
Comments
lang-php