4

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.

3
  • 1
    This isn't JSON? You'll probably have to write a decoder yourself for this format. Commented Oct 9, 2012 at 6:32
  • 3
    That looks like serialized PHP. Commented Oct 9, 2012 at 6:33
  • oh, thanks for all yr quick answers :) Commented Oct 9, 2012 at 6:41

2 Answers 2

4

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

Sign up to request clarification or add additional context in comments.

Comments

1

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/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.