Search code examples
javajsonquarkus

Quarkus isn't producing JSON from route


I have a method declared like this:

@GET
@Produces(MediaType.APPLICATION_JSON)
public List<arbitifer.models.Ticket> all() {

The method body just creates a fixed list value and returns it.

The result when I curl this route is:

$ curl -v http://localhost:8080/tickets
*   Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /tickets HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.81.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< content-length: 98
< Content-Type: application/json;charset=UTF-8
< 
* Connection #0 to host localhost left intact
[Ticket(id=1, story=As a user, I want to see a list of all tickets, so I can see what to work on)]

That, um, that is not JSON.

What configuration do I need to add / change to get Quarkus to serialize my model objects into actual / valid JSON?

This is using Quarkus version:

<quarkus.platform.version>2.11.3.Final</quarkus.platform.version>

Solution

  • The problem was that my jackson dependency:

    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-resteasy-reactive-jackson</artifactId>
    </dependency>
    

    in pom.xml wasn't being processed. Probably forgot to save the pom.xml file.