title: Deserializing JSON to Java using Jackson
body: <p>I am working with JSON for the very first time and I am trying to deserialise a JSON file into Java objects.</p>
  
  <p><strong>InputJSON</strong></p>
  
  <pre><code>{
  
      "student_id" : "123",
       "courses":[
          {
           "course_id":"789",
           "professor":"abc"
          }
        ]
  }
  {
      "student_id":"234",
       courses:[
         {
           "course_id":"789",
           "professor":"pqr"
         },
         {
           "course_id":"789",
           "professor":"xyz"
         }
       ]
  }
  {
     "student_id" : "345",
       "courses":[
          {
           "course_id":"567",
           "professor":"lmn"
          }
        ]
  }
  </code></pre>
  
  <p><strong>Student.class</strong></p>
  
  <pre><code>class Student {
  
     @JsonProperty("student_id")
     private String studentId;
     @JsonProperty("courses")
     private List&lt;Courses&gt; courses;
  
     //getters and setters
  
  }
  </code></pre>
  
  <p><strong>Courses.class</strong></p>
  
  <pre><code>public class Courses {
  
      @JsonProperty("course_id")
      private String courseId;
      @JsonProperty("professor")
      private String professor;
  
      //getters and setters
  }
  </code></pre>
  
  <p>My <strong>JsonHelper.class</strong> creates an object of Object Mapper class and uses readValue(new File("Input.json"),Student.class) to to map the json fields to Java objects.</p>
  
  <p>What I want to do is create a map with studentId as a key and the list of courses as the value corresponding to each studentId. </p>
  
  <p>I am not exactly getting how to achieve it since my list is just able to get 1 element and the list size is thus 1. And issue with creating the map too. 
  Any help will be appreciated.</p>