I'm trying to unmarshall some received json (from Jira restful web service).
Problem is: an "issue" has a "summary" property and a list of fields.
Summary is not present as an attribute in the received json, but as a value of the "fields" attribute. I insist on unmarshalling to this structure:
@XmlRootElement
class Issue {
String summary;
List<Field> fields;
// getters/setters and lots of other fields
}
Received JSON:
{
"expand":"html",
"self":"https://example.com/jira/rest/api/latest/issue/XYZ-1234",
"key":"XYZ-1234",
"fields":
{
"summary":
{
"name":"summary",
"type":"java.lang.String",
"value":"test 1234"
},
"customfield_10080":
{
"name":"Testeur",
"type":"com.atlassian.jira.plugin.system.customfieldtypes:userpicker"
},
"status":
{
"name":"status",
"type":"com.atlassian.jira.issue.status.Status",
"value":
{
"self":"https://example.com/jira/rest/api/latest/status/5",
"name":"Resolved"
}
},
...
},
"transitions":"https://example.com/jira/rest/api/latest/issue/XYZ-1234/transitions"
}
I don't want to use Jira's own client (too many dependencies which I don't want in my app).
edit: I asked my question another way to try to make it clear: how to map a bean structure to a different schema with jax-rs