The returned result of json data parsing is null. what's the problem?

Source: Internet
Author: User
The returned result of json data parsing is null. what is the problem? This is the case: Website A provides A connection interface. After I verify that the logon information is passed, A json data is returned, but I use $ response = json_decode ($ output ); however, no data is available and the returned result is empty. how can I parse json data into an array correctly and truncate the data in part? PHPcode {json data is parsed and returned as null?
The problem is as follows:

Website A provides A connection interface. After I verify that the logon information is passed, A json data is returned. However, I use $ response = json_decode ($ output), but I cannot get the data and the returned result is empty; how can I parse json data into arrays,
Partial data truncation:
PHP code
  {"Total": 359, "data": [{"Id": 113023, "ProductId": 2905, "ProductCode": "SZX01", "ProductName ": "Computer Book Series", "ProcessDays": 1, "ProcessResume": "", "WorkDayPrice": 79.0000, "WeekdayPrice": 89.0000, "NormalPrice": 0.0000, "Catalog": "0", "Type": 0, "RDCatalog": 0, "BizCatalog": 0, "StartDate": new Date (1350691200000), "Deleted ": 0 },{ "Id": 113024, "TourId": 2905, "ProductCode": "SZX01", "ProductName": "Children's Books series", "ProcessDays ": 1, "ProcessResume": "", "WorkDayPrice": 79.0000, "WeekdayPrice": 89.0000, "NormalPrice": 0.0000, "Catalog": "0", "Type ": 0, "RDCatalog": 0, "BizCatalog": 0, "StartDate": new Date (1350777600000), "Deleted": 0}]}

My code is as follows:
PHP code
  
  





------ Solution --------------------
Because
"StartDate": new Date (1350691200000 ),
The result is that you can remove it from the string. you try it. I tested it just now.
------ Solution --------------------
PHP code
$ S = '{"total": 359, "data": [{"Id": 113023, "ProductId": 2905, "ProductCode": "SZX01 ", "ProductName": "Computer Book Series", "ProcessDays": 1, "ProcessResume": "", "WorkDayPrice": 79.0000, "WeekdayPrice": 89.0000, "NormalPrice ": 0.0000, "Catalog": "0", "Type": 0, "RDCatalog": 0, "BizCatalog": 0, "StartDate": new Date (1350691200000 ), "Deleted": 0 },{ "Id": 113024, "TourId": 2905, "ProductCode": "SZX01", "ProductName": "children's book series ", "ProcessDays": 1, "ProcessResume": "", "WorkDayPrice": 79.0000, "WeekdayPrice": 89.0000, "NormalPrice": 0.0000, "Catalog": "0 ", "Type": 0, "RDCatalog": 0, "BizCatalog": 0, "StartDate": new Date (1350777600000), "Deleted": 0}]} '; $ s = preg_replace ('/new Date [^,] +/', '"$0"', $ s); print_r (json_decode ($ s )); /* stdClass Object ([total] => 359 [data] => Array ([0] => stdClass Object ([Id] => 113023 [ProductId] => 2905 [ProductCode] => SZX01 [ProductName] => computer book series [ProcessDays] => 1 [ProcessResume] => [WorkDayPrice] => 79 [WeekdayPrice] => 89 [NormalPrice] => 0 [Catalog] => 0 [Type] => 0 [RDCatalog] => 0 [BizCatalog] => 0 [StartDate] => new Date (1350691200000) [Deleted] => 0) [1] => stdClass Object ([Id] => 113024 [TourId] => 2905 [ProductCode] => SZX01 [ProductName] => children's book series [ProcessDays] => 1 [ProcessResume] => [WorkDayPrice] => 79 [WeekdayPrice] => 89 [NormalPrice] => 0 [Catalog] => 0 [Type] => 0 [RDCatalog] => 0 [BizCatalog] => 0 [StartDate] => new Date (1350777600000) [Deleted] => 0 )))*/
Related Article

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.