Java background accepts the processing of a nested JSON array in a JSON array __java

Source: Internet
Author: User

First, mobile phone to the Java background interface, sometimes due to the needs of the business needs to pass the data JSON array nested JSON array, background received after the need to deal with

Eg: front-end data structure:
			front-end data structure: Linejson =[{"startprovince": "2", "Startcity": "2", "Carlist": [{"Carid": "1", "Telephone" : "15091060694", "remark": "Memo"}]}]  
			background received: String Linejson=getpara ("Linejson");
			Jsonarray Linearray=jsonarray.fromobject (Linejson);
			for (int j=0;j<linearray.size (); j + +) {
				jsonobject Line=jsonobject.fromobject (Linearray.get (j));
				String startprovince=line.getstring ("startprovince");
				Jsonarray Carlist=jsonarray.fromobject (line.getstring ("Carlist"));
				for (int i=0;i<carlist.size (); i++) {
						business logic
				}
			}


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.