0

I would like to know how can we serialize the following using Jackson.

I have the following class:

public Class School{

private Map<Teacher,List<Student>> exampleMap;

//Getter and Setter

}

Teacher & Student are two other entities.

If I now want to serialize this into JSON using Jackson, how should I proceed?

som6233
  • 47
  • 6

1 Answers1

0

Json treats map's key as String and it default implementation simply calls its toString method.

The following post has clear explanantion, this might help you.

Can we make object as key in map when using JSON?

Saravanakrishnan Pk
  • 451
  • 1
  • 5
  • 15
Alekhya
  • 272
  • 1
  • 7