In Java, is there a nice way of serializing a collection of objects as a single JSON object of parallel arrays?
For example, given a Collection of type Person
class Person {
String firstName;
String lastName;
int age;
}
I would want to produce the following JSON:
{
"firstName": ["Allison", "Stanley", "Adrian"],
"lastName": ["Smith", "Williams", "Davis"],
"age": [23, 17, 42]
}
I'd prefer to use jackson if possible, but all suggestions are welcome.