How can I create a json array like the example below using jackson.
I tried using ObjectMapper, but this does not seem correct.
try (Director
You can write an object to a json string. So I hope you have your data in an object of a class defined as per your need. Here is how you can convert that object into a json string:
//1. Convert Java object to JSON format
ObjectMapper mapper = new ObjectMapper();
String jsonString = mapper.writeValueAsString(yourObject);
See here for the full jackson-databind javadoc.