public class JacksonTester3 {
    public static void main(String[] args) {
        try {
            ObjectMapper mapper = new ObjectMapper();
            Map<String, Object> studentDataMap = new HashMap<String, Object>();
            Student student = new Student();
            student.setAge(18);
            student.setName("出👆");
            int[] marks = {1, 2, 3};

            studentDataMap.put("student", student);
            studentDataMap.put("name", "Mahesh Kumar");
            studentDataMap.put("verified", Boolean.FALSE);
            studentDataMap.put("marks", marks);

            mapper.writeValue(new File("student2.json"), studentDataMap);

            studentDataMap = mapper.readValue(new File("student2.json"), Map.class);

            System.out.println(studentDataMap.get("student"));
            System.out.println(studentDataMap.get("name"));
            System.out.println(studentDataMap.get("verified"));
            System.out.println(studentDataMap.get("marks"));
        } catch (JsonGenerationException e) {
            e.printStackTrace();
        } catch (JsonMappingException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

@Lombok
class Student{
  private String name;
  private Integer age;
}