Package org.json

Examples of org.json.JSONObject.optString()


        FileInputStream fileInputStream = new FileInputStream(f);
        try {
            JSONObject metadataJson = loadMetadataJson(f);
            String predefinedId = null;
            if (metadataJson != null) {
                predefinedId = metadataJson.optString("id", null);
                String metadataVisibilitySource = metadataJson.optString("visibilitySource", null);
                if (metadataVisibilitySource != null) {
                    visibilitySource = metadataVisibilitySource;
                }
            }
View Full Code Here


        try {
            JSONObject metadataJson = loadMetadataJson(f);
            String predefinedId = null;
            if (metadataJson != null) {
                predefinedId = metadataJson.optString("id", null);
                String metadataVisibilitySource = metadataJson.optString("visibilitySource", null);
                if (metadataVisibilitySource != null) {
                    visibilitySource = metadataVisibilitySource;
                }
            }
View Full Code Here

        JSONObject formatObject = json.optJSONObject("format");
        if (formatObject != null) {
            JSONObject tagsObject = formatObject.optJSONObject("tags");
            if (tagsObject != null) {
                String firstDesiredValue = tagsObject.optString(firstSearchString);
                if (!firstDesiredValue.equals("")) {
                    return firstDesiredValue;
                }
                String secondDesiredValue = tagsObject.optString(secondSearchString);
                if (!secondDesiredValue.equals("")) {
View Full Code Here

            if (tagsObject != null) {
                String firstDesiredValue = tagsObject.optString(firstSearchString);
                if (!firstDesiredValue.equals("")) {
                    return firstDesiredValue;
                }
                String secondDesiredValue = tagsObject.optString(secondSearchString);
                if (!secondDesiredValue.equals("")) {
                    return secondDesiredValue;
                }
            }
        }
View Full Code Here

        JSONObject formatObject = json.optJSONObject("format");
        if (formatObject != null) {
            JSONObject tagsObject = formatObject.optJSONObject("tags");
            if (tagsObject != null) {
                String locationString = tagsObject.optString("location");
                if (!locationString.equals("")) {
                    GeoPoint geoPoint = parseGeoLocationString(locationString);
                    if (geoPoint != null) {
                        return geoPoint;
                    }
View Full Code Here

        JSONObject formatObject = json.optJSONObject("format");
        if (formatObject != null) {
            JSONObject tagsObject = formatObject.optJSONObject("tags");
            if (tagsObject != null) {
                String dateTaken = null;
                String optionalDateTaken = tagsObject.optString("date");
                if (!optionalDateTaken.equals("")) {
                    dateTaken = optionalDateTaken;
                } else {
                    String optionalDateTakenEng = tagsObject.optString("date-eng");
                    if (!optionalDateTakenEng.equals("")) {
View Full Code Here

                String dateTaken = null;
                String optionalDateTaken = tagsObject.optString("date");
                if (!optionalDateTaken.equals("")) {
                    dateTaken = optionalDateTaken;
                } else {
                    String optionalDateTakenEng = tagsObject.optString("date-eng");
                    if (!optionalDateTakenEng.equals("")) {
                        dateTaken = optionalDateTakenEng;
                    }
                }
View Full Code Here

    protected static Object parseGeoLocation(String valueStr) {
        try {
            JSONObject json = new JSONObject(valueStr);
            double latitude = json.getDouble("latitude");
            double longitude = json.getDouble("longitude");
            String altitudeString = json.optString("altitude");
            Double altitude = (altitudeString == null || altitudeString.length() == 0) ? null : Double.parseDouble(altitudeString);
            String description = json.optString("description");
            return new GeoPoint(latitude, longitude, altitude, description);
        } catch (Exception ex) {
            Matcher match = GEO_LOCATION_FORMAT.matcher(valueStr);
View Full Code Here

            JSONObject json = new JSONObject(valueStr);
            double latitude = json.getDouble("latitude");
            double longitude = json.getDouble("longitude");
            String altitudeString = json.optString("altitude");
            Double altitude = (altitudeString == null || altitudeString.length() == 0) ? null : Double.parseDouble(altitudeString);
            String description = json.optString("description");
            return new GeoPoint(latitude, longitude, altitude, description);
        } catch (Exception ex) {
            Matcher match = GEO_LOCATION_FORMAT.matcher(valueStr);
            if (match.find()) {
                double latitude = Double.parseDouble(match.group(1).trim());
View Full Code Here

    JSONObject entry = feed.getJSONArray("Entry").getJSONObject(0);

    assertEquals(entryTitle, entry.getString("Title"));
    assertEquals(entryLink, entry.getString("Link"));
    assertNull("getSummaries has the wrong default value (should be false).",
        entry.optString("Summary", null));
    assertTrue(rewriter.responseWasRewritten());
  }

  @Test
  public void testFetchFeedWithParameters() 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.