Open midmarch opened 3 months ago
Is it possible to define an attribute with raw JSON?
I have got the following DTO, with the property `geoShape is raw GeoJSON JSON.
import io.leangen.graphql.annotations.GraphQLInputField; import io.leangen.graphql.annotations.GraphQLQuery; public class GeoLocation { /** * Geo */ @GraphQLQuery @GraphQLInputField private String geoShape; }
Returning the following result querying for that attribute:
{ "geoShape": "{ \"type\": \"Feature\", \"geometry\": { \"type\": \"Point\", \"coordinates\": [125.6, 10.1] }, \"properties\": { \"name\": \"Dinagat Islands\" } }" }
What I like to havem is the following:
{ "geoShape": { "type": "Feature", "geometry": { "type": "Point", "coordinates": [125.6, 10.1] }, "properties": { "name": "Dinagat Islands" } } }
I tried to add @JsonRawValue
@JsonRawValue
import com.fasterxml.jackson.annotation.JsonRawValue; import io.leangen.graphql.annotations.GraphQLInputField; import io.leangen.graphql.annotations.GraphQLQuery; public class GeoLocation { /** * Geo */ @GraphQLQuery @GraphQLInputField @JsonRawValue private String geoShape; }
But that made no difference. Also tried to use a Jackson JsonNode, instread of a String, which resulted in Runtime errors.
Do you have any advice?
Is it possible to define an attribute with raw JSON?
I have got the following DTO, with the property `geoShape is raw GeoJSON JSON.
Returning the following result querying for that attribute:
What I like to havem is the following:
I tried to add
@JsonRawValue
But that made no difference. Also tried to use a Jackson JsonNode, instread of a String, which resulted in Runtime errors.
Do you have any advice?