javajsonobjectmappercamundazeebe

Zeebe Java. Correct way to store json in variable


I use java/kotlin + zeebe and I want to store my dto object as JSON. When I use objectMapper.writeValueAsString(dto) my final json in operate looks like "{\"id\":\"10\"}.

I think zeebe can store JSON without escaping characters. Could you tell me what is the best way to compose JSON from DTO object?


Solution

  • I found the answer. For correct JSON saving I use objectMapper.convertValue(dto, ObjectNode::class.java)

    After that in operate showed correct JSON without escaping characters. If you want to store array of object use ArrayNode class.

    That's helped me