title: Content is not allowed in prolog while parsing a json
body: <p>I am trying to parse a json file using the following code as </p>
  
  <pre><code>public class JSONParsing {
  
  private static final String XMLOutput = "C:/Users/Content/Downloads/outputxml.txt";
  
  public static void main(String[] args) throws Exception {
  
          try{
  
  
          String URLfile = "xxxx"
  
  
          // Step 1&gt; 
          // Connecting to the Website to get the JSON file
          URL url = new URL(URLfile);
          URLConnection conn = url.openConnection();
  
          // Step 2&gt; to get the information as an 'input stream'
          DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          DocumentBuilder builder = factory.newDocumentBuilder();
          Document doc = builder.parse(conn.getInputStream());
  
          TransformerFactory tfactory = TransformerFactory.newInstance();
          Transformer xform = tfactory.newTransformer();
  
          File myOutput = new File(XMLOutput);
          xform.transform(new DOMSource(doc), new StreamResult(myOutput));
      InputStream is = 
              JSONParsing.class.getResourceAsStream( "C:/Users/Content/Downloads/outputxml.txt");
      String jsonTxt = IOUtils.toString( is );
  
      JSONObject json = (JSONObject) JSONSerializer.toJSON( jsonTxt );        
      int listingCount = json.getInt( "listingCount" );
      double totalBudget = json.getDouble( "totalBudget" );
      double cpc = json.getDouble("cpc");
  
  
      System.out.println( "Listing Count: " + listingCount );
      System.out.println( "Total Budget: " + totalBudget );
      System.out.println( "CPC :"+cpc);
  
  }catch(Exception e){
      System.out.println("There is an error :"+e);
  }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>My input file is  in this format as - </p>
  
  <pre><code>{"listingCount":10,"totalBudget":25000.00,"cpc":0.54,"ctr":null}
  </code></pre>
  
  <p>Error </p>
  
  <pre><code> Error : [Fatal Error] :1:1: Content is not allowed in prolog.
   There is an error :org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
  </code></pre>
  
  <p>Any help is appreciated.</p>