Return a sentiment object populated by the values in the json object.  Return
null if there are no sentiment data.

@param jsonKeyword object containing the keyword values

@return sentiment object populated by the values in the json object
172356
private SentimentAlchemyEntity getSentiment(final JSONObject jsonKeyword) {
    SentimentAlchemyEntity sentiment = null;
    final JSONObject sentimentObject = getJSONObject(JSONConstants.SENTIMENT_KEY, jsonKeyword);
    if(sentimentObject == null) {
      return sentiment;
    }

    final String type = getString(JSONConstants.SENTIMENT_TYPE_KEY, sentimentObject);
    final Double score = getDouble(JSONConstants.SENTIMENT_SCORE_KEY, sentimentObject);
    final Integer mixed = getInteger(JSONConstants.SENTIMENT_MIXED_KEY, sentimentObject);

    if(isValidSentiment(type, score, mixed)) {
      sentiment = new SentimentAlchemyEntity();
      if(!StringUtils.isBlank(type)) {
        sentiment.setType(type);
      }
      if(score != null) {
        sentiment.setScore(score);
      }
      if(mixed != null) {
        sentiment.setIsMixed(mixed);
      }
    }
    return sentiment;
  }
1178518
public static JsonWebKey jsonWebKeyFromString(String jwkString) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        return mapper.readValue(jwkString, JsonWebKey.class);
    }
17179
public String getString( int index ) {
      Object o = get( index );
      if( o != null ){
         return o.toString();
      }
      throw new JSONException( "JSONArray[" + index + "] not found." );
   }
941963
private JSONObject getConvertedResponseAsJson(SpellCheckResponse response) {

        if (null == response) {
            return null;
        }

        final JSONObject suggestions = new JSONObject();
        final Map<String, Suggestion> solrSuggestions = response.getSuggestionMap();

        // Add suggestions to the response
        for (final String key : solrSuggestions.keySet()) {

            // Indicator to ignore words that are erroneously marked as misspelled.
            boolean ignoreWord = false;

            // Suggestions that are in the form "Xxxx" -> "xxxx" should be ignored.
            if (Character.isUpperCase(key.codePointAt(0))) {
                final String lowercaseKey = key.toLowerCase();
                // If the suggestion map doesn't contain the lowercased word, ignore this entry.
                if (!solrSuggestions.containsKey(lowercaseKey)) {
                    ignoreWord = true;
                }
            }

            if (!ignoreWord) {
                try {
                    // Get suggestions as List
                    final List<String> l = solrSuggestions.get(key).getAlternatives();
                    suggestions.put(key, l);
                } catch (JSONException e) {
                    LOG.debug("Exception while converting Solr spellcheckresponse to JSON. ", e);
                }
            }
        }

        return suggestions;
    }
341725
static public String createMetaphoneVersionOfKeyword(final String _keyword)
    {
        if (_keyword == null || _keyword.trim().length() == 0)
            return null;
        return new Metaphone().metaphone(_keyword);
    }
859201
public JSONArray getJSONArray(K key) {
		final Object object = this.getObj(key);
		if(null == object) {
			return null;
		}
		
		if(object instanceof JSONArray) {
			return (JSONArray) object;
		}
		return new JSONArray(object);
	}
125259
public JSONObject getJson() throws JSONException {
        JSONObject json = create();
        json.put("type", type);
        json.put("category", getCategory());
        if (label != null && !label.isEmpty())
            json.put("label", label);
        if (displaySequence != null && displaySequence > 0)
            json.put("sequence", displaySequence);
        if (display != null)
            json.put("display", display.toString());
        return json;
    }
1341332
public IJsonMarshaller getJsonMarshallerFromAnnotation(JsonUnmarshaller jua) throws JsonMarshallerException {
		if (jua != null) {
			return argumentServices.getIJsonMarshallerInstance(jua.value());
		}
		return null;
	}
311033
public JSONObject getLinkDataJsonObject() {
        JSONObject linkDataJson = new JSONObject();
        try {
            if (!TextUtils.isEmpty(channel)) {
                linkDataJson.put("~" + Defines.LinkParam.Channel.getKey(), channel);
            }
            if (!TextUtils.isEmpty(alias)) {
                linkDataJson.put("~" + Defines.LinkParam.Alias.getKey(), alias);
            }
            if (!TextUtils.isEmpty(feature)) {
                linkDataJson.put("~" + Defines.LinkParam.Feature.getKey(), feature);
            }
            if (!TextUtils.isEmpty(stage)) {
                linkDataJson.put("~" + Defines.LinkParam.Stage.getKey(), stage);
            }
            if (!TextUtils.isEmpty(campaign)) {
                linkDataJson.put("~" + Defines.LinkParam.Campaign.getKey(), campaign);
            }
            if (has(Defines.LinkParam.Tags.getKey())) {
                linkDataJson.put(Defines.LinkParam.Tags.getKey(), getJSONArray(Defines.LinkParam.Tags.getKey()));
            }
            linkDataJson.put("~" + Defines.LinkParam.Type.getKey(), type);
            linkDataJson.put("~" + Defines.LinkParam.Duration.getKey(), duration);
        } catch (JSONException ignore) {
        }
        return linkDataJson;
    }
1367776
static JsonArray getArrayFromJsonElement(JsonElement jsonElement) {
        JsonArray jsonArray = null;
        if (jsonElement.isJsonArray()) {
            jsonArray = jsonElement.getAsJsonArray();
        } else if (jsonElement.isJsonObject() &&
                ((JsonObject) jsonElement).get("results") != null &&
                ((JsonObject) jsonElement).get("results").isJsonArray()) {
            jsonArray = ((JsonObject) jsonElement).get("results").getAsJsonArray();
        }
        return jsonArray;
    }
150705
public JSONObject getJSONObject(String key) throws JSONException {
    Object o = get(key);
    if (o instanceof JSONObject) {
      return (JSONObject) o;
    }
    throw new JSONException("JSONObject[" + quote(key) + "] is not a JSONObject.");
  }
722062
public static JsonObject getJsonQuery(URL url) throws MalformedURLException {
        String query = url.getQuery();
        JsonObject payload = new JsonObject();
        JsonParser parser = new JsonParser();

        if (query == null) {
            return null;
        }

        for (String kv : query.split("&")) {
            String[] parts = kv.split("=");

            if (parts.length != 2) {
                throw new MalformedURLException();
            }

            String optName = parts[0];
            JsonElement optVal;
            try {
                optVal = parser.parse(URLDecoder.decode(parts[1], "UTF-8"));
            } catch (UnsupportedEncodingException e) {
                throw new MalformedURLException();
            }

            payload.add(optName, optVal);
        }
        return payload;
    }
1345203
@javax.annotation.Nonnull
  public JsonObject getJson() {
    @javax.annotation.Nonnull final JsonObject json = new JsonObject();
    json.addProperty("min", min);
    json.addProperty("max", max);
    json.addProperty("negatives", negatives);
    json.addProperty("positives", positives);
    json.addProperty("zeros", zeros);
    json.addProperty("sum0", sum0);
    json.addProperty("sum1", sum1);
    json.addProperty("sum2", sum2);
    json.addProperty("sumLog", sumLog);
    return json;
  }
609896
public String getStringFrom(JsonValue json) {
    if (json.isString()) {
      return json.asString();
    } else {
      return json.toString();
    }
  }
1334743
public String get(String key) {
        Preconditions.checkNotNull(key, "key is null");
        return values.get(key);
    }
343419
public SensitiveWordStatusResult getSensitiveWordStatus() throws APIConnectionException, APIRequestException {
        ResponseWrapper responseWrapper = _httpClient.sendGet(_baseUrl + sensitiveWordPath + "/status");
        return _gson.fromJson(responseWrapper.responseContent, SensitiveWordStatusResult.class);
    }
766141
public final PJsonObject optJSONObject(final String key) {
        final JSONObject val = this.obj.optJSONObject(key);
        return val != null ? new PJsonObject(this, val, key) : null;
    }