title: Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Expected ':' at line
body: <p>I have seen the same questions over stackoverflow, which tells about extra comma and spaces in Json. But it did nt helped me.</p>
  
  <p>I am having a json of this format with POJO</p>
  
  <pre><code> {"binary":[
      {
      "attributeIndex": 4,
      "attributeValue": "no",
      "binaryValue": "1,0"
    },
    {
      "attributeIndex": 4,
      "attributeValue": "yes",
      "binaryValue": "0,1"
    }
  ]}
  </code></pre>
  
  <p>POJO</p>
  
  <pre><code>public class BinPojo {
  
      /**
       * @param args
       */
      int attributeIndex;
      String attributeValue;
      String binaryValue;
  and
  
  public class BinaryPojo {
  
      /**
       * @param args
       */
      JSONArray binary;
  </code></pre>
  
  <p>I am trying to get  attributeIndex,attributeValue,binaryValue values
  But I am getting this error</p>
  
  <pre><code>Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Expected ':' at line 1 column 65
      at com.google.gson.Gson.fromJson(Gson.java:818)
      at com.google.gson.Gson.fromJson(Gson.java:768)
      at com.google.gson.Gson.fromJson(Gson.java:717)
      at com.google.gson.Gson.fromJson(Gson.java:689)
  </code></pre>
  
  <p>at </p>
  
  <pre><code>BinPojo getData = gson.fromJson(meta.get(j).toString(), BinPojo.class);
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>JSONArray meta = new JSONArray();
  //file read
  String setupData = bf.readLine();
  BinaryPojo d = gson.fromJson(setupData, BinaryPojo.class);
  meta = d.getBinary();
  
   //JSONArray meta which holds the JSON data
  for (int j = 0; j &lt; meta.size(); j++) {
      BinPojo getData = gson.fromJson(meta.get(j).toString(), BinPojo.class);
      System.out.println("gson"+gson.toJson(getData));
      int attrIndex = getData.getAttributeIndex();
      System.out.println("attrIndex: "+attrIndex);
      String attrVal = getData.getAttributeValue();               
  }
  </code></pre>
  
  <p>What could be the reason. It is telling that my JSON is bad.how can I debug this.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Once I print this: </p>
  
  <pre><code>System.out.println("meta: "+meta.get(j).toString());
  </code></pre>
  
  <p>My result is </p>
  
  <blockquote>
    <p>meta: {attributeIndex=0.0, attributeValue=Middleaged,
    binaryValue=1,0,0}</p>
  </blockquote>
  
  <p>and</p>
  
  <pre><code>for (int j = 0; j &lt; meta.size(); j++) {
      System.out.println("meta: "+meta.get(j).toString());
      BinPojo getData = null ;
      try{
          getData = gson.fromJson(meta.get(j).toString(), BinPojo.class);
      }catch(Exception e){
              e.printStackTrace();
      }
      System.out.println("gson "+gson.toJson(getData));
      int attrIndex = getData.getAttributeIndex();
      System.out.println("attrIndex: "+attrIndex);
      String attrVal = getData.getAttributeValue();           
      }
  </code></pre>
  
  <p>getData is returning null.</p>
  
  <pre><code>gson null
  java.lang.Exception: java.lang.NullPointerException
      at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:354)
  Caused by: java.lang.NullPointerException
  </code></pre>