Get a String field from the JSON.

@param json      JSON document.
@param fieldName Field name to get.
@return String value of field or null if not present.
167263
private String getTextField(JsonNode json, String fieldName) {
        if (!json.has(fieldName)) {
            return null;
        }
        return json.get(fieldName).asText();
    }
828409
public String getString(String name, boolean strict) throws JsonException {
        JsonElement el = get(name);
        String res = null;
        if (strict && !el.isString()) {
            throw Util.typeMismatch(name, el, "string", true);
        }
        res = el.toString();
        if (res == null)
            throw Util.typeMismatch(name, el, "string", strict);
        return res;
    }
319533
public Object getFieldValue(final String field) {
        
        final FieldError error = getFirstFieldError(field).orElse(null);
        if(error != null && !error.isConversionFailure()) {
            return error.getRejectedValue();
        } else {
            return getFieldActualValue(field);
        }
        
    }
1198612
@Nullable
  public Object get(@Nonnull String field) {
    return get(FieldPath.fromDotSeparatedString(field));
  }
834268
public static JsonNode getFieldValue(JsonNode doc, String field) {
        StringTokenizer tkz = new StringTokenizer(field, ". ");
        JsonNode trc = doc;
        while (tkz.hasMoreTokens() && trc != null) {
            String tok = tkz.nextToken();
            trc = trc.get(tok);
        }
        return trc;
    }
84942
private String getSystemField(String fieldName) {
        List<String> values = m_valueMap.get(fieldName);
        return values == null ? null : values.get(0);
    }
112624
private Integer getIntegerField(JsonNode json, String fieldName) {
        if (!json.has(fieldName)) {
            return null;
        }
        return json.get(fieldName).intValue();
    }
440558
public <T> T getField(String fieldName, Class<T> clazz) {
        return DPathUtils.getValue(fieldData, fieldName, clazz);
    }
881767
public static String getFieldValue(ODocument document, String fieldname) {
        return (String) document.field(fieldname);
    }
1351893
public static String getString(JsonObject object, String field, String defaultValue) {
        final JsonValue value = object.get(field);
        if (value == null || value.isNull()) {
            return defaultValue;
        } else {
            return value.asString();
        }
    }
913651
public static boolean isValidFieldName(String fieldName) {
        return fieldName != null &&
               fieldName.length() > 0 &&
               Utils.isLetter(fieldName.charAt(0)) &&
               Utils.allAlphaNumUnderscore(fieldName);
    }
956255
public String getString(String key) throws JSONException {
        Object object = this.get(key);
        if (object instanceof String) {
            return (String) object;
        } else if( NULL.equals(object) ) {
            return (String) null;
        }
        throw new JSONException("JSONObject[" + quote(key) + "] not a string.");
    }
343849
public Optional<JsonObject> findFirstWithFieldValue(@Nonnull String fieldName, String value) {
        JsonElement result = findFirstMatching(e -> {
            if(!e.isObject()) {
                return false;
            }
            JsonObject object = e.asObject();
            String fieldValue = object.getString(fieldName);
            if(fieldValue !=null) {
                return fieldValue.equals(value);
            } else {
                return false;
            }
        }).orElse(null);
        if(result != null) {
            return Optional.of(result.asObject());
        } else {
            return Optional.empty();
        }
    }
107658
public static JsonArray getArray(JsonObject object, String field) {
        final JsonValue value = object.get(field);
        throwExceptionIfNull(value, field);
        return value.asArray();
    }
717149
public static String getString(Object from, Field field)
    {
        PropertyAccessor<?> accessor = PropertyAccessorFactory.getPropertyAccessor(field);
        Object object = getObject(from, field);
        return object != null ? accessor.toString(object) : null;
    }
834225
@Nonnull
  public JSFieldVar field (@Nonnull @Nonempty final String sName)
  {
    return field (sName, null);
  }
82025
public static <T> T getFieldValue(final Object obj, final String fieldName) {
		Field field = getField(obj.getClass(), fieldName);
		if (field == null) {
			throw new IllegalArgumentException("Could not find field [" + fieldName + "] on target [" + obj + ']');
		}
		return getFieldValue(obj, field);
	}