Hello guy's here i m sharing Json response parsing method to do parse in particular pojo class.
here you need to get your Json response in your String variable before start parsing it.
Here in Your MUsers Class need to contain all require keys to parse it based on your Json response contains no of keys . here explaining with single key value parsing class as below it would be like.
here you need to get your Json response in your String variable before start parsing it.
do this process in Your Class
String result = "Your Json Resonse" ; List<MUsers> mUsers = null; try { Gson gson = new Gson(); Type type = new TypeToken<List<MUsers>>(){}.getType(); mUsers = gson.fromJson(result, type); } catch (JsonSyntaxException e) { e.printStackTrace(); }
Here in Your MUsers Class need to contain all require keys to parse it based on your Json response contains no of keys . here explaining with single key value parsing class as below it would be like.
public class MUsers{ @SerializedName("USR") @Expose private String usr; public void setUSR(String usern) { this.usr = usern; } public String getUSR() { return usr; } }
Here in your build.gradle file need to add supportive library to parse this data
No comments:
Post a Comment
Comments