java - JSON object within object -


this question has answer here:

"fid": "123", "farm_info": {     "name": "example farm",     "address": "example address",     "phone": "111-111-1111",     "web": "" }, "personal_info": {     "name": "myname",     "email": "myname@example.com",     "phone": "111-111-0000" }, "delivers_to": ["60001", "60002"] 

this object returned json. in java fid string , delivers_to array of strings. data type farm_info , personal_info have json returned?

a class custom defined data type in java (you can define group of elements structure in c) , so, farm_info , personal_info object types.

so parse json, along data types mentioned, need below custom defined datatypes (java classes).

public class farminfo {      private string name;      private string address;      private string phone;      private string ;web       //getter , setter methods need generated }  public class  personalinfo {     private string name;     private string email;     private string phone;     //getter , setter methods need generated } 

you can refer here more classes , objects.

also, refer here understanding json parsing.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -