Package org.json

Examples of org.json.JSONTokener.nextValue()


      }
     
      sw.flush();
     
      JSONTokener tokener = new JSONTokener(sw.toString());
      result = tokener.nextValue();
     
    } catch (Exception e) {
      throw new Exception("Error while reading file: "+file.getName(), e);
     
    } finally {
View Full Code Here


public class GeoJsonParser {

  public List<GeoJsonFeature> parse(Reader reader) throws Exception {
    try {
      JSONTokener tokener = new JSONTokener(reader);
      Object obj = tokener.nextValue();
      if( obj instanceof JSONObject ) {
        JSONObject featureCollection = (JSONObject)obj;
       
        return parseFeatureCollection(featureCollection);
       
View Full Code Here

         
          fis.close();
          fis = null;
         
          JSONTokener tokener = new JSONTokener(sw.toString());
          Object infoObj = tokener.nextValue();
          if( infoObj instanceof JSONObject ) {
            JSONObject info = (JSONObject)infoObj;
           
            {
              String testName = info.optString(DocumentStoreProcess.ATT_INFO_NAME);
View Full Code Here

      }
     
      sw.flush();
     
      JSONTokener tokener = new JSONTokener(sw.toString());
      result = tokener.nextValue();
     
    } catch (Exception e) {
      throw new Exception("Error while reading file: "+file.getName(), e);
     
    } finally {
View Full Code Here

      tokener.back();
      return new JSONArray(tokener);
    }
    if (Character.isDigit(firstChar)) {
      tokener.back();
      return tokener.nextValue();
    }
    tokener.back();
    return tokener.nextValue();
  }
View Full Code Here

    if (Character.isDigit(firstChar)) {
      tokener.back();
      return tokener.nextValue();
    }
    tokener.back();
    return tokener.nextValue();
  }

  public static String reformat(String inputJson) {
    String lineSeperator = System.getProperty("line.separator");
    inputJson = inputJson.replaceAll(lineSeperator, "");
View Full Code Here

      b = isr.read();
    }
    sw.flush();
   
    JSONTokener jsonTokener = new JSONTokener(sw.toString());
    Object obj = jsonTokener.nextValue();
   
    return obj;
  }
 
  static public <T> T getJsonFromInputStream(InputStream contentStream, String encoding, Class<T> clazz) throws Exception {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.