Package org.json

Examples of org.json.JSONTokener.nextValue()


          s =  sb.toString();
        } finally {
            reader.close();
        }
        JSONTokener t = new JSONTokener(s);
        Object o = t.nextValue();
        if (o instanceof JSONObject) {
            return (JSONObject) o;
        } else {
            throw new JSONException(s + " couldn't be parsed as JSON object");
        }
View Full Code Here


    protected void load() throws IOException, JSONException{
      File vocabsFile = new File(workingDir,SAVED_VOCABULARIES_FILE_NAME);
      FileReader reader = new FileReader(vocabsFile);
        try {
            JSONTokener tokener = new JSONTokener(reader);
            JSONObject obj = (JSONObject) tokener.nextValue();
            JSONArray prefixes = obj.getJSONArray("prefixes");
            for(int i=0;i<prefixes.length();i++){
              JSONObject p = prefixes.getJSONObject(i);
              String name = p.getString("name");
              String uri = p.getString("uri");
View Full Code Here

  }
 
  public void loadFromFile(FileInputStream in) throws JSONException, IOException{
    try {
            JSONTokener tokener = new JSONTokener(new InputStreamReader(in));
            JSONObject obj = (JSONObject) tokener.nextValue();
            JSONArray services = obj.getJSONArray("services");
            for(int i=0;i<services.length();i++){
              JSONObject serviceObj = services.getJSONObject(i);
              String type = serviceObj.getString("type");
              ReconciliationService service;
View Full Code Here

                            throws IOException
                        {
                            try
                            {
                                JSONTokener tokener = new JSONTokener( item );
                                JSONObject entity = (JSONObject) tokener.nextValue();
                                String id = entity.getString( JSONKeys.IDENTITY );
                                store.put( new EntityReference( id ), item );
                            }
                            catch( JSONException e )
                            {
View Full Code Here

                                                          jsonBody));
            case '}':
                return params;
            default:
                x.back();
                key = x.nextValue().toString();
            }

            /*
             * The key is followed by ':'. We will also tolerate '=' or '=>'.
             */
 
View Full Code Here

                }
            } else if (c != ':') {
                throw new IllegalArgumentException(format("String '%s' is not a valid JSON object representation, expected a ':' after the key '%s'",
                                                          jsonBody, key));
            }
            Object value = x.nextValue();

            // guard from null values
            if (value != null) {
                if (value instanceof JSONArray) { // only plain simple arrays in this version
                    JSONArray array = (JSONArray) value;
View Full Code Here

          }
         
          sw.flush();
         
          JSONTokener tokener = new JSONTokener(sw.toString());
          Object result = tokener.nextValue();
         
          if( result instanceof JSONObject ){
            JSONObject jsonManifest = (JSONObject)result;
            installedFileSetManifest = FileSetManifest.fromJSON(jsonManifest);
          } else {
View Full Code Here

                                                           body));
                case '}':
                    return Collections.unmodifiableMap(parameters);
                default:
                    x.back();
                    key = x.nextValue().toString();
                }

                /*
                 * The key is followed by ':'. We will also tolerate '=' or '=>'.
                 */
 
View Full Code Here

                    }
                } else if (c != ':') {
                    throw new OAuthRuntimeException(format("String '%s' is not a valid JSON object representation, expected a ':' after the key '%s'",
                                                           body, key));
                }
                Object value = x.nextValue();

                // guard from null values
                if (value != null) {
                    if (value instanceof JSONArray) { // only plain simple arrays in this version
                        JSONArray array = (JSONArray) value;
View Full Code Here

                                                          jsonBody));
            case '}':
                return params;
            default:
                x.back();
                key = x.nextValue().toString();
            }

            /*
             * The key is followed by ':'. We will also tolerate '=' or '=>'.
             */
 
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.