Parse a JSON string containing ImageryMetaData response
@param a_jsonContent	the JSON content string
@return	ImageryMetaDataResource object containing parsed information
@throws Exception
978044
static public ImageryMetaDataResource getInstanceFromJSON(final String a_jsonContent) throws Exception
	{

		if(a_jsonContent==null) {
			throw new Exception("JSON to parse is null");
		}

		/// response code should be 200 and authorization should be valid (valid BingMap key)
		final JSONObject jsonResult = new JSONObject(a_jsonContent);
		final int statusCode = jsonResult.getInt(STATUS_CODE);
		if(statusCode!=200) {
			throw new Exception("Status code = "+statusCode);
		}

		if(AUTH_RESULT_CODE_VALID.compareToIgnoreCase(jsonResult.getString(AUTH_RESULT_CODE))!=0) {
			throw new Exception("authentication result code = "+jsonResult.getString(AUTH_RESULT_CODE));
		}

		// get first valid resource information
		final JSONArray resultsSet = jsonResult.getJSONArray(RESOURCE_SETS);
		if(resultsSet==null || resultsSet.length()<1) {
			throw new Exception("No results set found in json response");
		}

		if(resultsSet.getJSONObject(0).getInt(ESTIMATED_TOTAL)<=0) {
			throw new Exception("No resource found in json response");
		}

		final JSONObject resource = resultsSet.getJSONObject(0).getJSONArray(RESOURCE).getJSONObject(0);

		return ImageryMetaDataResource.getInstanceFromJSON(resource,jsonResult);
	}
77502
public JSONArray asJSONArray() throws TwitterException {
        if (jsonArray == null) {
            try {
                jsonArray = new JSONArray(asString());
                if (CONF.isPrettyDebugEnabled()) {
                    logger.debug(jsonArray.toString(1));
                } else {
                    logger.debug(responseAsString != null ? responseAsString :
                        jsonArray.toString());
                }
            } catch (JSONException jsone) {
                if (logger.isDebugEnabled()) {
                    throw new TwitterException(jsone.getMessage() + ":" + this.responseAsString, jsone);
                } else {
                    throw new TwitterException(jsone.getMessage(), jsone);
                }
            } finally {
                disconnectForcibly();
            }
        }
        return jsonArray;
    }
520392
private static JSONObject parseTarget(Shape target) throws JSONException {
        JSONObject targetObject = new JSONObject();

        targetObject.put("resourceId",
                         target.getResourceId().toString());

        return targetObject;
    }
730734
public static List<MailboxNodeContent> parseMailboxContents(List<String> jsons) throws JSONException {
        ArrayList<MailboxNodeContent> objects = new ArrayList<MailboxNodeContent>(jsons.size());
        for (String json : jsons) {
            MailboxNodeContent content = null;
            JSONObject jsObj = new JSONObject(json);
            long HSId = jsObj.getLong("HSId");
            Integer partitionId = null;
            if (jsObj.has("partitionId")) {
                partitionId = jsObj.getInt("partitionId");
            }
            content = new MailboxNodeContent(HSId, partitionId);
            objects.add(content);
        }
        return objects;
    }
785835
public HashMap<String,Double> getArrayMeasures(JSONObject jsonContent){
		HashMap<String,Double> i = new HashMap<String,Double>();
		return i;
	}
826371
public static JsonNode parse(final String jsonString) {
        if (Strings.isEmpty(jsonString)) {
            return newObject();
        }

        try {
            return createObjectMapper().readValue(jsonString, JsonNode.class);
        } catch (Throwable e) {
            throw new ParseException(String.format("can't parse string [%s]", jsonString), e);
        }
    }
598137
public static JSONArray parseJsonArray(URL url) throws IOException {
        String path = url.toString();
        if (path.startsWith(ValueConsts.LOCAL_FILE_URL)) {
            return parseJsonArray(NetUtils.urlToString(url));
        } else {
            return JSONArray.parseArray(read(url));
        }
    }
1264582
public static DocumentContext parse(InputStream json, Configuration configuration) {
        return new ParseContextImpl(configuration).parse(json);
    }
850662
private static void parseTarget(ArrayList<Shape> shapes,
                                    JSONObject modelJSON,
                                    Shape current) throws JSONException {
        if (modelJSON.has("target")) {
            JSONObject targetObject = modelJSON.getJSONObject("target");
            if (targetObject.has("resourceId")) {
                current.setTarget(getShapeWithId(targetObject.getString("resourceId"),
                                                 shapes));
            }
        }
    }
1106961
public String parseErrorCode(HttpResponse response, JsonContent jsonContent) {
        String errorCodeFromHeader = parseErrorCodeFromHeader(response.getHeaders());
        if (errorCodeFromHeader != null) {
            return errorCodeFromHeader;
        } else if (jsonContent != null) {
            return parseErrorCodeFromContents(jsonContent.getJsonNode());
        } else {
            return null;
        }
    }
315180
def jsonarrinsert(self, name, path, index, *args):
        
        pieces = [name, str_path(path), index]
        for o in args:
            pieces.append(self._encode(o))
        return self.execute_command('JSON.ARRINSERT', *pieces)
776099
public JSONObject asJSONObject() throws TwitterException {
        if (json == null) {
            try {
                json = new JSONObject(asString());
                if (CONF.isPrettyDebugEnabled()) {
                    logger.debug(json.toString(1));
                } else {
                    logger.debug(responseAsString != null ? responseAsString :
                        json.toString());
                }
            } catch (JSONException jsone) {
                if (responseAsString == null) {
                    throw new TwitterException(jsone.getMessage(), jsone);
                } else {
                    throw new TwitterException(jsone.getMessage() + ":" + this.responseAsString, jsone);
                }
            } finally {
                disconnectForcibly();
            }
        }
        return json;
    }
975961
private void parsePointMetadata(JsonParser jp) throws IOException, SQLException {
        jp.nextToken(); // FIELD_NAME coordinates        
        String coordinatesField = jp.getText();
        if (coordinatesField.equalsIgnoreCase(GeoJsonField.COORDINATES)) {
            jp.nextToken(); // START_ARRAY [ to parse the coordinate
            parseCoordinateMetadata(jp);            
        } else {
            throw new SQLException("Malformed GeoJSON file. Expected 'coordinates', found '" + coordinatesField + "'");
        }
    }
1139081
private static JSON toJSON( String string, JsonConfig jsonConfig ) {
      JSON json = null;
      if( string.startsWith( "[" ) ){
         json = JSONArray.fromObject( string, jsonConfig );
      }else if( string.startsWith( "{" ) ){
         json = JSONObject.fromObject( string, jsonConfig );
      }else if( "null".equals( string ) ){
         json = JSONNull.getInstance();
      }else{
         throw new JSONException( "Invalid JSON String" );
      }

      return json;
   }
549863
private Object readJSON() throws JSONException {
        switch (read(3)) {
        case zipObject:
            return readObject();
        case zipArrayString:
            return readArray(true);
        case zipArrayValue:
            return readArray(false);
        case zipEmptyObject:
            return new JSONObject();
        case zipEmptyArray:
            return new JSONArray();
        case zipTrue:
            return Boolean.TRUE;
        case zipFalse:
            return Boolean.FALSE;
        default:
            return JSONObject.NULL;
        }
    }
513143
@NonNull
    public JSONObject toJson() throws JSONException {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put(KEY_COMPONENT_NAME, (mComponentName != null) ? mComponentName.flattenToShortString() : null);
        jsonObject.put(KEY_IMAGE_URI, (mImageUri != null) ? mImageUri.toString() : null);
        jsonObject.put(KEY_TITLE, mTitle);
        jsonObject.put(KEY_BYLINE, mByline);
        jsonObject.put(KEY_ATTRIBUTION, mAttribution);
        jsonObject.put(KEY_TOKEN, mToken);
        jsonObject.put(KEY_VIEW_INTENT, (mViewIntent != null)
                ? mViewIntent.toUri(Intent.URI_INTENT_SCHEME) : null);
        jsonObject.put(KEY_META_FONT, mMetaFont);
        jsonObject.put(KEY_DATE_ADDED, mDateAdded != null ? mDateAdded.getTime() : 0);
        return jsonObject;
    }
1091613
public static Object parseStrict(String s) throws ParseException {
		return new JSONParser(MODE_RFC4627).parse(s, defaultReader.DEFAULT);
	}