Here is the full example:
public class PaginatedUserData extends UserDataAvro {
@JsonValue
public String serialize() throws JsonProcessingException {
ObjectMapper mapper = new ObjectMapper();
HashMap<String, String> map = new HashMap<>();
map.put("test", "5");
return mapper.writeValueAsString(map);
}}
Returns:
Could not write JSON: Not an array
On Monday, 16 March 2020 11:02:57 UTC+1, Matej wrote:
>
> Hello,
>
> I am working on a rest api application and i have some problems with the
> code. Part of code that is problematic is:
>
> @JsonValue
> public String serialize() throws JsonProcessingException {
> ObjectMapper mapper = new ObjectMapper();
> return mapper.writeValueAsString(this);
> }
>
> This returns not an enum. The current object is an extend of avro schema.
> I also tried:
>
> @JsonValue
> public String serialize() throws JsonProcessingException {
> ObjectMapper mapper = new ObjectMapper();
> return mapper.writeValueAsString(getUserData());
> }
>
> Where user data is an actual avro object. I dont understand what do these
> error mean. Can someone explain? Also, is there a better way to return an
> avro object combined with other parameters?
>
> Thanks
>
--
You received this message because you are subscribed to the Google Groups
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jackson-user/d0c6400c-f207-41b8-b450-b80255816647%40googlegroups.com.