Json string to array

Source: Internet
Author: User
Json string to array problem string (186) & nbsp; {id: 2, num: 2, store: 9, name: taimington abrasion warning line (front, back), price: 88.00} string (96) & nbsp; {id: 2, num: 1, store: 9, name: taimington abrasion warning line (front, back), price json string to array conversion problem
String (186) "{" id ":" 2 "," num ": 2," store ":" 9 "," name ":" taimington abrasion warning line (front,) "," price ":" 88.00 "}"
String (96) "{" id ":" 2 "," num ": 1," store ":" 9 "," name ":" taimington abrasion warning line (front,) "," price ":" 88.00 "}"

The above two json strings look at the same length and print out a 186, 96, and 96 string, which can be converted into an array using json_decode, but not 186 ~~
------ Solution ----------------------
The last one is 96 characters long and is a normal json string, so it can be decoded.
The previous one is 186 characters long and obviously contains other content, so it cannot be decoded. You can observe the results of var_dump in text mode.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.