title: Java parsed JSON array (GSON) gives back zero or null
body: <p>I have a JSON array that looks like this:</p>
  <pre><code>[
    {
      &quot;ScanDateTime&quot;: &quot;2020-10-11T00:04:05&quot;,
      &quot;RecipeName&quot;: &quot;_BLANK_16&quot;,
      &quot;Slot&quot;: 13,
      &quot;DefectTotal&quot;: 0,
      &quot;AreaCount&quot;: 3,
      &quot;Part1&quot;: 0,
      &quot;Part2&quot;: 0,
      &quot;Part3&quot;: 0,
      &quot;Part4&quot;: 0,
      &quot;Part5&quot;: 0,
      &quot;Part6&quot;: 0,
      &quot;Part7&quot;: 0,
      &quot;Part8&quot;: 0,
      &quot;HazeRegion&quot;: 0,
      &quot;HazeAverage&quot;: 0,
      &quot;HazePeak&quot;: 0,
      &quot;TotalScratch&quot;: 0
    },
    {
      &quot;ScanDateTime&quot;: &quot;2020-10-11T00:34:36&quot;,
      &quot;RecipeName&quot;: &quot;_BLANK_16&quot;,
      &quot;Slot&quot;: 24,
      &quot;DefectTotal&quot;: 50,
      &quot;AreaCount&quot;: 5,
      &quot;Part1&quot;: 21,
      &quot;Part2&quot;: 25,
      &quot;Part3&quot;: 0,
      &quot;Part4&quot;: 1,
      &quot;Part5&quot;: 1,
      &quot;Part6&quot;: 2,
      &quot;Part7&quot;: 0,
      &quot;Part8&quot;: 0,
      &quot;HazeRegion&quot;: 0,
      &quot;HazeAverage&quot;: 0,
      &quot;HazePeak&quot;: 0,
      &quot;TotalScratch&quot;: 0
    },
    {
      &quot;ScanDateTime&quot;: &quot;2020-10-11T00:35:26&quot;,
      &quot;RecipeName&quot;: &quot;_BLANK_16&quot;,
      &quot;Slot&quot;: 23,
      &quot;DefectTotal&quot;: 192,
      &quot;AreaCount&quot;: 2401,
      &quot;Part1&quot;: 34,
      &quot;Part2&quot;: 63,
      &quot;Part3&quot;: 30,
      &quot;Part4&quot;: 16,
      &quot;Part5&quot;: 9,
      &quot;Part6&quot;: 40,
      &quot;Part7&quot;: 0,
      &quot;Part8&quot;: 0,
      &quot;HazeRegion&quot;: 0,
      &quot;HazeAverage&quot;: 0,
      &quot;HazePeak&quot;: 0,
      &quot;TotalScratch&quot;: 39.205788
    },
    {
      &quot;ScanDateTime&quot;: &quot;2020-10-11T03:05:29&quot;,
      &quot;RecipeName&quot;: &quot;_BLANK_16&quot;,
      &quot;Slot&quot;: 0,
      &quot;DefectTotal&quot;: 945,
      &quot;AreaCount&quot;: 57,
      &quot;Part1&quot;: 273,
      &quot;Part2&quot;: 479,
      &quot;Part3&quot;: 93,
      &quot;Part4&quot;: 33,
      &quot;Part5&quot;: 35,
      &quot;Part6&quot;: 32,
      &quot;Part7&quot;: 0,
      &quot;Part8&quot;: 0,
      &quot;HazeRegion&quot;: 0,
      &quot;HazeAverage&quot;: 0,
      &quot;HazePeak&quot;: 0,
      &quot;TotalScratch&quot;: 0
    },
    {
      &quot;ScanDateTime&quot;: &quot;2020-10-11T03:06:55&quot;,
      &quot;RecipeName&quot;: &quot;_BLANK_16&quot;,
      &quot;Slot&quot;: 4,
      &quot;DefectTotal&quot;: 842,
      &quot;AreaCount&quot;: 78,
      &quot;Part1&quot;: 203,
      &quot;Part2&quot;: 469,
      &quot;Part3&quot;: 95,
      &quot;Part4&quot;: 33,
      &quot;Part5&quot;: 13,
      &quot;Part6&quot;: 29,
      &quot;Part7&quot;: 0,
      &quot;Part8&quot;: 0,
      &quot;HazeRegion&quot;: 0,
      &quot;HazeAverage&quot;: 0,
      &quot;HazePeak&quot;: 0,
      &quot;TotalScratch&quot;: 0
    },
    {
      &quot;ScanDateTime&quot;: &quot;2020-10-11T03:07:44&quot;,
      &quot;RecipeName&quot;: &quot;_BLANK_16&quot;,
      &quot;Slot&quot;: 9,
      &quot;DefectTotal&quot;: 391,
      &quot;AreaCount&quot;: 56,
      &quot;Part1&quot;: 125,
      &quot;Part2&quot;: 214,
      &quot;Part3&quot;: 25,
      &quot;Part4&quot;: 6,
      &quot;Part5&quot;: 11,
      &quot;Part6&quot;: 10,
      &quot;Part7&quot;: 0,
      &quot;Part8&quot;: 0,
      &quot;HazeRegion&quot;: 0,
      &quot;HazeAverage&quot;: 0,
      &quot;HazePeak&quot;: 0,
      &quot;TotalScratch&quot;: 0
    }
  ]
  </code></pre>
  <p>I use GSON to parse it and have an class <code>Messung</code> that looks like this:</p>
  <pre><code>public class Messung {
  private String scanDateTime;
  private String recipeName;
  private int slot;
  private int defectTotal;
  private int areaCount;
  private int part1;
  private int part2;
  private int part3;
  private int part4;
  private int part5;
  private int part6;
  private int part7;
  private int part8;
  private double hazeRegion;
  private double hazePeak;
  private double totalScratch;
  
  public Messung(String scanDateTime, String recipeName, int slot, int defectTotal1, int areaCount1, int part1, int part2, int part3, int part4, int part5, int part6, int part7, int part8, double hazeRegion, double hazePeak, double totalScratch){
      this.scanDateTime = scanDateTime;
      this.recipeName = recipeName;
      this.slot = slot;
      this.defectTotal = defectTotal1;
  
      this.areaCount = areaCount1;
      this.part1 = part1;
      this.part2 = part2;
      this.part3 = part3;
      this.part4 = part4;
      this.part5 = part5;
      this.part6 = part6;
      this.part7 = part7;
      this.part8 = part8;
      this.hazeRegion = hazeRegion;
      this.hazePeak = hazePeak;
      this.totalScratch = totalScratch;
  }
  
  public String getScanDateTime() {
      return scanDateTime;
  }
  
  public String getRecipeName() {
      return recipeName;
  }
  
  public int getSlot() {
      return slot;
  }
  
  public int getDefectTotal() {
      return defectTotal;
  }
  
  public int getAreaCount() {
      return areaCount;
  }
  
  public int getPart1() {
      return part1;
  }
  
  public int getPart2() {
      return part2;
  }
  
  public int getPart3() {
      return part3;
  }
  
  public int getPart4() {
      return part4;
  }
  
  public int getPart5() {
      return part5;
  }
  
  public int getPart6() {
      return part6;
  }
  
  public int getPart7() {
      return part7;
  }
  
  public int getPart8() {
      return part8;
  }
  
  public double getHazeRegion() {
      return hazeRegion;
  }
  
  public double getHazePeak() {
      return hazePeak;
  }
  
  public double getTotalScratch() {
      return totalScratch;
  }
  
  @Override
  public String toString() {
      return &quot;Messung [ScanDateTime=&quot; + scanDateTime + &quot;, RecipeName=&quot; + recipeName + &quot;, Slot=&quot; + slot + &quot;, DefectTotal=&quot; + defectTotal + &quot;, AreaCount=&quot; + areaCount + &quot;, Part1=&quot; + part1 + &quot;, Part2=&quot; + part2 + &quot;, Part3=&quot; + part3 + &quot;, Part4=&quot; + part4 + &quot;, Part5=&quot; + part5 + &quot;, Part6=&quot; + part6 + &quot;, Part7=&quot; + part7 + &quot;, Part8=&quot; + part8 + &quot;, HazeRegion=&quot; + hazeRegion + &quot;, HazePeak=&quot; + hazePeak + &quot;, TotalScratch=&quot; + getTotalScratch() + &quot;]&quot;;
  }
  </code></pre>
  <p>}</p>
  <p>This is the part of my script where I try to parse it:</p>
  <pre><code>while(!isExisting){
          try {
              File myObj = new File(&quot;C:\\workspace\\AccessDBReader-6420-II\\AccessDBReader-6420-II\\bin\\Release\\Publish\\Messung-6420-II.txt&quot;);
              Scanner myReader = new Scanner(myObj);
              while (myReader.hasNextLine()) {
                  data = myReader.nextLine();
              }
              System.out.println(data);
              myReader.close();
              Gson gson = new Gson();
              Messung[] messungen = gson.fromJson(data, Messung[].class);
  
              for(Messung messung : messungen) {
                  System.out.println(messung);
              }
  
              isExisting = true;
          } catch (FileNotFoundException e) {
              Thread.sleep(10000);
              //e.printStackTrace();
          }
  </code></pre>
  <p>But when I try to print the Messung-objects I get <code>null</code> for Strings and 0 for <code>int</code> and <code>double</code>:</p>
  <pre><code>Messung [ScanDateTime=null, RecipeName=null, Slot=0, DefectTotal=0, AreaCount=0, Part1=0, Part2=0, Part3=0, Part4=0, Part5=0, Part6=0, Part7=0, Part8=0, HazeRegion=0.0, HazePeak=0.0, TotalScratch=0.0]
  Messung [ScanDateTime=null, RecipeName=null, Slot=0, DefectTotal=0, AreaCount=0, Part1=0, Part2=0, Part3=0, Part4=0, Part5=0, Part6=0, Part7=0, Part8=0, HazeRegion=0.0, HazePeak=0.0, TotalScratch=0.0]
  Messung [ScanDateTime=null, RecipeName=null, Slot=0, DefectTotal=0, AreaCount=0, Part1=0, Part2=0, Part3=0, Part4=0, Part5=0, Part6=0, Part7=0, Part8=0, HazeRegion=0.0, HazePeak=0.0, TotalScratch=0.0]
  Messung [ScanDateTime=null, RecipeName=null, Slot=0, DefectTotal=0, AreaCount=0, Part1=0, Part2=0, Part3=0, Part4=0, Part5=0, Part6=0, Part7=0, Part8=0, HazeRegion=0.0, HazePeak=0.0, TotalScratch=0.0]
  Messung [ScanDateTime=null, RecipeName=null, Slot=0, DefectTotal=0, AreaCount=0, Part1=0, Part2=0, Part3=0, Part4=0, Part5=0, Part6=0, Part7=0, Part8=0, HazeRegion=0.0, HazePeak=0.0, TotalScratch=0.0]
  Messung [ScanDateTime=null, RecipeName=null, Slot=0, DefectTotal=0, AreaCount=0, Part1=0, Part2=0, Part3=0, Part4=0, Part5=0, Part6=0, Part7=0, Part8=0, HazeRegion=0.0, HazePeak=0.0, TotalScratch=0.0]
  Messung [ScanDateTime=null, RecipeName=null, Slot=0, DefectTotal=0, AreaCount=0, Part1=0, Part2=0, Part3=0, Part4=0, Part5=0, Part6=0, Part7=0, Part8=0, HazeRegion=0.0, HazePeak=0.0, TotalScratch=0.0]
  Messung [ScanDateTime=null, RecipeName=null, Slot=0, DefectTotal=0, AreaCount=0, Part1=0, Part2=0, Part3=0, Part4=0, Part5=0, Part6=0, Part7=0, Part8=0, HazeRegion=0.0, HazePeak=0.0, TotalScratch=0.0]
  </code></pre>
  <p>What am I doing wrong?</p>