title: Java Error scanning JSONObject program using scanner scans infinitely
body: <p>I get this error on writing this program, i was wanting to just pass through the scanner to the JSONobject an print the json object </p>
  
  <p>But the scanner goes in infinite loop</p>
  
  <pre><code>package com.readvalues.main;
  
  import java.util.Scanner;
  import net.sf.json.JSONObject;
  
  public class ReadValues 
  {
      public static void main(String[] args)
      {
          String x="";
          try 
          {   
              System.out.println("Enter the data");
              Scanner scanner = new Scanner(System.in);
              while(scanner.hasNext())
              {
                  x = x + scanner.next();
              }
  
              JSONObject jsonObject = JSONObject.fromObject(x);
              System.out.println(jsonObject);
          }
          catch(Exception e)
          {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>IN THE TERMINAL </p>
  
  <pre><code>Enter the data
  {"ExecutiveGoal":
  {"EMPLID":"100020","GOAL_ID":"GOAL-3-98372","GOAL":"Conduct EPC Contract Kaizen","DUE_DATE":"07/01/2018","STATUS":"On Track or Complete (Green)","CATEGORY":"Operational Goal","SUPPORTS_ORG_GOAL":"","COMPLETED_ON":"06/30/2018","CREATED_BY":"Mark Hensley","CREATED_ON":"03/01/2018","LAST_UPDATED_BY":"Mark Hensley","LAST_UPDATED_ON":"03/01/2018"
  },
  "ExecutiveGoal":
  {"EMPLID":"100020","GOAL_ID":"GOAL-3-98373","GOAL":"Exit 2018 with minimum 5 negotiators trained and capable in O&amp;M, MSAs, EPCs, and MIPSAs. At least 2 negotiators capable in PPAs.","DUE_DATE":"12/31/2018","STATUS":"On Track or Complete (Green)","CATEGORY":"People Leader Goal","SUPPORTS_ORG_GOAL":"","COMPLETED_ON":"","CREATED_BY":"Mark Hensley","CREATED_ON":"03/01/2018","LAST_UPDATED_BY":"Mark Hensley","LAST_UPDATED_ON":"03/01/2018"
  }
  }
  //INFINITE LOOP SCANNING 
  </code></pre>
  
  <p>I've tried everyway</p>