You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great to be able to annotate a field with an XPath-like expression in addition to just a field name. The use case for this is to have a flatter POJO hierarchy than the JSON.
Example:
{
"some-meta-data": "foobar",
"comment":
{
"user": "Me",
"timestamp": 12345678,
"text": "WooHoo what an awesome comment"
}
}
Currently, if I am not interested in the metadata, I am still forced to create a top level Java object.
IMO these libraries serve a different purpose - querying large JSON data to extract certain information. For POJO-JSON mapping, a far simpler syntax would suffice.
None of the popular JSON mapping libraries for Java support this currently. GSON does provide a way to parse a JsonPath expression, but I did not find a way to specify the Path in place of a field name as an annotation.
The text was updated successfully, but these errors were encountered:
It would be great to be able to annotate a field with an XPath-like expression in addition to just a field name. The use case for this is to have a flatter POJO hierarchy than the JSON.
Example:
Currently, if I am not interested in the metadata, I am still forced to create a top level Java object.
Using an XPath-like expression, I could maybe even eliminate the need to create the top-level
Response
class altogether.Or perhaps, using a XPath expression, that might be
@JsonPathRoot("//comment")
.Prior art:
IMO these libraries serve a different purpose - querying large JSON data to extract certain information. For POJO-JSON mapping, a far simpler syntax would suffice.
None of the popular JSON mapping libraries for Java support this currently. GSON does provide a way to parse a JsonPath expression, but I did not find a way to specify the Path in place of a field name as an annotation.
The text was updated successfully, but these errors were encountered: