I have a JSON:
"account_representatives": [
{
"Sales Person": 1307,
"default_ticket_assignments": [
""
],
"Primary Account Manager": 1307,
"Secondary Support-3": 1151,
"Relationship Mgr": 1307,
"authorized_resources": [
""
],
"Technical Account Manager": 164
}
]
and I have a class whose structure is like this:
public class AccountRepresentative {
@SerializedName("authorized_resources")
@Expose
private List<String> authorizedResources = new ArrayList<String>();
@SerializedName("default_ticket_assignments")
@Expose
private List<String> defaultTicketAssignments = new ArrayList<String>();
@Expose
private Map<String, String> repFields;
/**
* @return The authorizedResources
*/
public List<String> getAuthorizedResources() {
return authorizedResources;
}
/**
* @param authorizedResources The authorized_resources
*/
public void setAuthorizedResources(List<String> authorizedResources) {
this.authorizedResources = authorizedResources;
}
/**
* @return The defaultTicketAssignments
*/
public List<String> getDefaultTicketAssignments() {
return defaultTicketAssignments;
}
/**
* @param defaultTicketAssignments The default_ticket_assignments
*/
public void setDefaultTicketAssignments(List<String> defaultTicketAssignments) {
this.defaultTicketAssignments = defaultTicketAssignments;
}
/**
*
* @return the dynamic jsonObjects
*/
public Map<String, String> getRepFields() {
return repFields;
}
/**
* @param repFields The repFields
*/
public void setRepFields(Map<String, String> repFields) {
this.repFields = repFields;
}
}
I'm using GSON to bind these, I'm able to bind the 2 JsonArrays.
I can also deserialized dynamic properties w/o the jsonArrays by using How can I convert JSON to a HashMap using Gson?,
but in this case, I have no idea how to get the dynamic properties, My plan supposedly is to turn the dynamic properties into hashmap, but the 2 jsonArrays are in the way.
Thanks for the help,