maxcellent/javadoc.io

Json PrettyPrint does not work

Closed this issue · 1 comments

Hi Camel Support,
I have been trying to leverage the PrettyPrint feature to display the result of my API that is using Apache Camel. Here is the context. I have this route in my code

// Route Definition for processing Health check request
                from("direct:processHealthCheckRequest")
                        .routeId("health")
                        .setHeader(Exchange.HTTP_RESPONSE_CODE, constant(200))
                        .setBody(constant(healthCheckResponse));

When I'm using Postman to test my API, the display is in pretty mode even though it is not set to true, like so

{
  "status": "UP"
}

Now when I'm using the following code to set the PrettyPrint to false, I'm still getting the same result. It looks like the PrettyPrint feature is not working as it is supposed to

// Route Definition for processing Health check request
                from("direct:processHealthCheckRequest")
                        .routeId("health")
                        .setHeader(Exchange.HTTP_RESPONSE_CODE, constant(200))
                        .setBody(constant(healthCheckResponse)).unmarshal().json(JsonLibrary.Jackson, HealthCheckResponse.class, false);

I'm expecting the result to be displayed on one line like here without changing the type from JSON to string.

{"status": "UP"}

Hi, this is not the camel support group.