Readable php json format

The following 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 to php array format?

I use the json_decode function, but returns nothing.

The earliest help was appreciated.

+4
source share
2 answers

This is a serialized php value, not JSON. use unserialize to return it back to its original value.

+4
source

This line is incorrect. json_decode correct. You must make the correct JSON string, and then it should work. If you want to know what the correct JSON string should look like, look at this site: http://www.json.org/

+1
source

Source: https://habr.com/ru/post/1438567/


All Articles