I have a JSON object structured like this:
{
"John": { ...Some JSON object... },
"Mary": { ...Some JSON object... },
"Sam": { ...Some JSON object... }
}
The values for the John, Mary, and Sam keys are all structured the same, let's say it maps to a PersonInfo Java class. How do I get a List<PersonInfo> by just getting the top level JSON objects keys as a List? I can't do something like this
import com.fasterxml.jackson.annotation.JsonProperty;
@Data
public class PersonRecord {
@JsonProperty("John")
private PersonInfo john;
}
Because I don't know the top level keys, so I can't hardcode John. I don't care about the name of the key, I just want to select the values from each of the top level keys and put them in a list.
Johnsince I don't know the top level keysMary,Sametc keys?