title: Decoding floating point number in simple.json Java
body: <p>I am trying to read and parse a json file using simple.json in Java. However, on floating point numbers I get error. How should I parse floating point numbers?</p>
  
  <p>The JSON File is like:</p>
  
  <pre><code>[
    {
      "region":"NF",
      "destination":"d1",
      "source":"s1",
      "time":2003,
      "value":0.1
    },
    {
      "region":"NF",
      "destination":"d2",
      "source":"s2",
      "time":2004,
      "value":0.002
    },
  ]
  </code></pre>
  
  <p>My code to parse it is:</p>
  
  <pre><code>JSONArray jsonArray = (JSONArray)obj;
  Iterator&lt;JSONObject&gt; iterator = jsonArray.iterator();
  
  while(iterator.hasNext()){
      JSONObject jsonObject = iterator.next();
      String region = (String) jsonObject.get("region");
      String src = (String) jsonObject.get("source");
      String dst = (String) jsonObject.get("destination");
      long time = (long) jsonObject.get("time");
      long val = (long) jsonObject.get("value");
  }
  </code></pre>