How to parse the json data

Source: Internet
Author: User
How to parse the json data
{"Heade": ["station times", "Station Name", "when", "Stay", "mileage", "second-class seat ", "First-class seat", "special seat"], "item": [["1", "Jinan West", "-", "07:05 ","-", "-", "-"], ["2", "Tai'an ", "59 kilometers", "19.5 yuan", "29.5 yuan", "-"], ["3", "Qufu East ", "7 points", "129 kilometers", "39.5 yuan", "64.5 yuan", "-"], ["4", "Tengzhou East ", "", "2 points", "185 kilometers", "54.5 yuan", "89.5 yuan", "-"], ["5", "Zaozhuang ", "", "", "2 points", "221 kilometers", "69.5 yuan", "109.5 yuan", "-"], ["6 ", "Xuzhou East", "2 points", "286 kilometers", "89.5 yuan", "139.5 yuan", "-"], ["7", "Bengbu South", "2 points", "442 kilometers", "134 yuan", "219 yuan", "Yuan ", "-"], ["8", "Nanjing South", "2 points", "617 kilometers", "189 yuan ", "304 yuan", "-"], ["9", "town Jiangnan", "2 points", "682 kilometers ", "209 yuan", "334 yuan", "-"], ["10", "Danyang North", "2 points ", "714 kilometers", "219 yuan", "354 yuan", "-"], ["11", "Changzhou North ", "2 points", "747 kilometers", "229 yuan", "369 yuan", "-"], ["12", "Wuxi East", "11: 32 ", "", "11 Points", "804 kilometers", "249 yuan", "399 yuan", "-"], ["13", "Suzhou North ", "", "", "2 points", "831 kilometers", "254 yuan", "409 yuan", "-"], ["14 ", "Kunshan South", "2 points", "862 kilometers", "263.5 yuan", "423.5 yuan", "-"], ["15", "Shanghai Hongqiao", "", "-", "-", "912", "278.5 yuan", "448.5 yuan ", "-"], "title ":"Interval: 912 interval time: 5 hours and 22 minutes"}

How can I parse this json data to obtain heade, item, and title?


Reply to discussion (solution)

{"Heade": ["station times", "Station Name", "when", "Stay", "mileage", "second-class seat ", "First-class seat", "special seat"], "item": [["1", "Jinan West", "-", "07:05 ","-", "-", "-"], ["2", "Tai'an ", "59 kilometers", "19.5 yuan", "29.5 yuan", "-"], ["3", "Qufu East ", "7 points", "129 kilometers", "39.5 yuan", "64.5 yuan", "-"], ["4", "Tengzhou East ", "", "2 points", "185 kilometers", "54.5 yuan", "89.5 yuan", "-"], ["5", "Zaozhuang ", "", "", "2 points", "221 kilometers", "69.5 yuan", "109.5 yuan", "-"], ["6 ", "Xuzhou East", "2 points", "286 kilometers", "89.5 yuan", "139.5 yuan", "-"], ["7", "Bengbu South", "2 points", "442 kilometers", "134 yuan", "219 yuan", "Yuan ", "-"], ["8", "Nanjing South", "2 points", "617 kilometers", "189 yuan ", "304 yuan", "-"], ["9", "town Jiangnan", "2 points", "682 kilometers ", "209 yuan", "334 yuan", "-"], ["10", "Danyang North", "2 points ", "714 kilometers", "219 yuan", "354 yuan", "-"], ["11", "Changzhou North ", "2 points", "747 kilometers", "229 yuan", "369 yuan", "-"], ["12", "Wuxi East", "11: 32 ", "", "11 Points", "804 kilometers", "249 yuan", "399 yuan", "-"], ["13", "Suzhou North ", "", "", "2 points", "831 kilometers", "254 yuan", "409 yuan", "-"], ["14 ", "Kunshan South", "2 points", "862 kilometers", "263.5 yuan", "423.5 yuan", "-"], ["15", "Shanghai Hongqiao", "", "-", "-", "912", "278.5 yuan", "448.5 yuan ", "-"], "title ":"Interval: 912 interval time: 5 hours and 22 minutes"}

$ Json = '{"heade": ["site Times", "site name", "when", "when", "Stay", "mileage", "second-class seat ", "First-class seat", "special seat"], "item": [["1", "Jinan West", "-", "07:05 ","-", "-", "-"], ["2", "Tai'an ", "59 kilometers", "19.5 yuan", "29.5 yuan", "-"], ["3", "Qufu East ", "7 points", "129 kilometers", "39.5 yuan", "64.5 yuan", "-"], ["4", "Tengzhou East ", "", "2 points", "185 kilometers", "54.5 yuan", "89.5 yuan", "-"], ["5", "Zaozhuang ", "", "", "2 points", "221 kilometers", "69.5 yuan", "109.5 yuan", "-"], ["6 ", "Xuzhou East", "2 points", "286 kilometers", "89.5 yuan", "139.5 yuan", "-"], ["7", "Bengbu South", "2 points", "442 kilometers", "134 yuan", "219 yuan", "Yuan ", "-"], ["8", "Nanjing South", "2 points", "617 kilometers", "189 yuan ", "304 yuan", "-"], ["9", "town Jiangnan", "2 points", "682 kilometers ", "209 yuan", "334 yuan", "-"], ["10", "Danyang North", "2 points ", "714 kilometers", "219 yuan", "354 yuan", "-"], ["11", "Changzhou North ", "2 points", "747 kilometers", "229 yuan", "369 yuan", "-"], ["12", "Wuxi East", "11: 32 ", "", "11 Points", "804 kilometers", "249 yuan", "399 yuan", "-"], ["13", "Suzhou North ", "", "", "2 points", "831 kilometers", "254 yuan", "409 yuan", "-"], ["14 ", "Kunshan South", "2 points", "862 kilometers", "263.5 yuan", "423.5 yuan", "-"], ["15", "Shanghai Hongqiao", "", "-", "-", "912", "278.5 yuan", "448.5 yuan ", "-"], "title ":"Interval: 912 interval time: 5 hours and 22 minutes"} '; $ Arr = json_decode ($ json); var_dump ($ arr-> heade );

$ S = '{"heade": ["site Times", "site name", "when", "when", "Stay", "mileage", "second-class seat ", "First-class seat", "special seat"], "item": [["1", "Jinan West", "-", "07:05 ","-", "-", "-"], ["2", "Tai'an ", "59 kilometers", "19.5 yuan", "29.5 yuan", "-"], ["3", "Qufu East ", "7 points", "129 kilometers", "39.5 yuan", "64.5 yuan", "-"], ["4", "Tengzhou East ", "", "2 points", "185 kilometers", "54.5 yuan", "89.5 yuan", "-"], ["5", "Zaozhuang ", "", "", "2 points", "221 kilometers", "69.5 yuan", "109.5 yuan", "-"], ["6 ", "Xuzhou East", "2 points", "286 kilometers", "89.5 yuan", "139.5 yuan", "-"], ["7", "Bengbu South", "2 points", "442 kilometers", "134 yuan", "219 yuan", "Yuan ", "-"], ["8", "Nanjing South", "2 points", "617 kilometers", "189 yuan ", "304 yuan", "-"], ["9", "town Jiangnan", "2 points", "682 kilometers ", "209 yuan", "334 yuan", "-"], ["10", "Danyang North", "2 points ", "714 kilometers", "219 yuan", "354 yuan", "-"], ["11", "Changzhou North ", "2 points", "747 kilometers", "229 yuan", "369 yuan", "-"], ["12", "Wuxi East", "11: 32 ", "", "11 Points", "804 kilometers", "249 yuan", "399 yuan", "-"], ["13", "Suzhou North ", "", "", "2 points", "831 kilometers", "254 yuan", "409 yuan", "-"], ["14 ", "Kunshan South", "2 points", "862 kilometers", "263.5 yuan", "423.5 yuan", "-"], ["15", "Shanghai Hongqiao", "", "-", "-", "912", "278.5 yuan", "448.5 yuan ", "-"], "title ":"Interval: 912 interval time: 5 hours and 22 minutes"} '; If (mb_check_encoding ($ s, 'gbk') $ s = mb_convert_encoding ($ s, 'utf-8', 'gbk '); print_r (json_decode ($ s, 1 ));
Array ([heade] => Array ([0] => site count [1] => site name [2] => then [3] => when sending [4] => stay [5] => mileage [6] => second-class seat [7] => first-class seat [8] => special seat) [item] => Array ([0] => Array ([0] => 1 [1] => Jinan West [2] =>-[3] => 07:05 [4] =>-[5] =>-[6] =>-[7] =>-[8] => -) [1] => Array ([0] => 2 [1] => Tai'an [2] => [3] => [4] => [5] => 59 km [6] => 19.5 yuan [7] => 29.5 yuan [8] => -) [2] => Array ([0] => 3 [1] => Qufu East [2] => [3] => [4] => [5] => 129 [6] => 39.5 yuan [7] => 64.5 yuan [8] => -) [3] => Array ([0] => 4 [1] => Tengzhou East [2] => 08:11 [3] => 08:13 [4] => 2 minutes [5] => 185 [6] => 54.5 yuan [7] => 89.5 yuan [8] => -) [4] => Array ([0] => 5 [1] => Zaozhuang [2] => 08:26 [3] => 08:28 [4] => 2 points [5] => 221 [6] => 69.5 yuan [7] => 109.5 yuan [8] => -) [5] => Array ([0] => 6 [1] => Xuzhou East [2] => 08:48 [3] => 08:50 [4] => 2 minutes [5] => 286 [6] => 89.5 yuan [7] => 139.5 yuan [8] => -) [6] => Array ([0] => 7 [1] => Bengbu South [2] => 09:32 [3] => 09:34 [4] => 2 minutes [5] => 442 [6] => 134 yuan [7] => 219 yuan [8] => -) [7] => Array ([0] => 8 [1] => Nanjing South [2] => [3] => [4] => 2 minutes [5] => 617 [6] => 189 yuan [7] => 304 yuan [8] => -) [8] => Array ([0] => 9 [1] => zhenjiangnan [2] => [3] => [4] => 2 minutes [5] => 682 [6] => 209 yuan [7] => 334 yuan [8] => -) [9] => Array ([0] => 10 [1] => Danyang north [2] => 10: 57 [3] => 10: 59 [4] => 2 [5] => 714 [6] => 219 yuan [7] => 354 yuan [8] => -) [10] => Array ([0] => 11 [1] => Changzhou North [2] => 11: 12 [3] => 11: 14 [4] => 2 [5] => 747 [6] => 229 yuan [7] => 369 yuan [8] => -) [11] => Array ([0] => 12 [1] => Wuxi East [2] => 11: 32 [3] => 11: 43 [4] => 11 [5] => 804 [6] => 249 yuan [7] => 399 yuan [8] => -) [12] => Array ([0] => 13 [1] => Suzhou North [2] => 11: 54 [3] => 11: 56 [4] => 2 [5] => 831 [6] => 254 yuan [7] => 409 yuan [8] => -) [13] => Array ([0] => 14 [1] => Kunshan South [2] => [3] => [4] => [5] => 862 [6] => 263.5 yuan [7] => 423.5 yuan [8] => -) [14] => Array ([0] => 15 [1] => Shanghai Hongqiao [2] => 12: 27 [3] =>-[4] =>-[5] => 912 [6] => 278.5 yuan [7] => 448.5 yuan [8] => -)) [title] =>Interval: 912 interval time: 5 hours and 22 minutes)

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.