XML to JSON, how to filter data

Source: Internet
Author: User
XML to JSON, how to filter data?
The XML below, want to convert to JSON
But the P-node requires only The data for these two nodes is not required for other data.
If you go directly with Json_encode, it's all data.
How can I convert to JSON, but as long as Data, how to get it?

For example
{"PN": "\u7b2c\u4e00\u5468\u64ad\u5267\u573a\uff1a\u8ffd\u9c7c\u4f20\u5947", "PT": "2013-08-19 22:01:00"}

-------XML---------



110171675
Tom
2013-08-19 00:02:00
46
24
74750
0
2013-08-19 00:02:00
Am



110171676
I'm a great beauty.
2013-08-19 01:15:00
46
24
74501
0
2013-08-19 01:15:00
Am



110171677
John doe
2013-08-19 02:09:00
46
24
64519
71411
2013-08-19 02:09:00
Am



JSON XML

Share to:


------Solution--------------------
$string = <<
 <>

  • 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.