jsonText = value.
164188
public Object parse() {
    Object val = null;
    if(T.isValueType()) {
      val = parseValue();
    } else {
      addError();
    }
    return val;
  }
155517
private JsonElement convertValue(String value, JsonObject dataType) {
    if (dataType == null || !dataType.has(TYPE)) {
      return new JsonPrimitive(value);
    }

    String type = dataType.get(TYPE).getAsString().toUpperCase();
    ValueType valueType = ValueType.valueOf(type);
    return valueType.convert(value);
  }
691090
@JsonValue
	public Object toJsonValue() {
		if (s != null)
			return s;
		if (n != null)
			return n;
		return null;
	}
1020049
public PactDslJsonArray stringValue(String value) {
      if (value == null) {
        body.put(JSONObject.NULL);
      } else {
        body.put(value);
      }
      return this;
    }
107709
private static String getJsonValueAsNumberString(JsonValue value) {
        return (value != null && value.getValueType() == ValueType.NUMBER) ? value.toString() : null;
    }
1189668
private static VarValueDef asValueDef( String valueName, JsonObject json)
    {
    try
      {
      VarValueDef valueDef = new VarValueDef( ObjectUtils.toObject( valueName));

      // Get the type of this value
      boolean failure = json.getBoolean( FAILURE_KEY, false);
      boolean once = json.getBoolean( ONCE_KEY, false);
      valueDef.setType
        ( failure? VarValueDef.Type.FAILURE :
          once? VarValueDef.Type.ONCE :
          VarValueDef.Type.VALID);

      if( failure && json.containsKey( PROPERTIES_KEY))
        {
        throw new SystemInputException( "Failure type values can't define properties");
        }

      // Get annotations for this value
      Optional.ofNullable( json.getJsonObject( HAS_KEY))
        .ifPresent( has -> has.keySet().stream().forEach( key -> valueDef.setAnnotation( key, has.getString( key))));
    
      // Get the condition for this value
      Optional.ofNullable( json.getJsonObject( WHEN_KEY))
        .ifPresent( object -> valueDef.setCondition( asValidCondition( object)));

      // Get properties for this value
      Optional.ofNullable( json.getJsonArray( PROPERTIES_KEY))
        .map( properties -> toIdentifiers( properties)) 
        .ifPresent( properties -> valueDef.addProperties( properties)); 

      return valueDef;
      }
    catch( SystemInputException e)
      {
      throw new SystemInputException( String.format( "Error defining value=%s", valueName), e);
      }
    }
609896
public String getStringFrom(JsonValue json) {
    if (json.isString()) {
      return json.asString();
    } else {
      return json.toString();
    }
  }
770122
private Object getJSONValue(Object value) throws JSONException {
    if (value instanceof Bundle) {
      return getJSONForBundle((Bundle) value);
    } else if (value instanceof CharSequence) {
      return value.toString();
    } else if (value instanceof List) {
      JSONArray array = new JSONArray();
      for (Object listValue : (List<?>) value) {
        array.put(getJSONValue(listValue));
      }
      return array;
    } else if (value instanceof SparseArray) {
      JSONArray array = new JSONArray();
      SparseArray<?> sparseValue = (SparseArray<?>) value;
      for (int i = 0; i < sparseValue.size(); i++) {
        array.put(sparseValue.keyAt(i), getJSONValue(sparseValue.valueAt(i)));
      }
      return array;
    } else if (value instanceof Character) {
      return value.toString();
    } else if (value instanceof Boolean) {
      return value;
    } else if (value instanceof Number) {
      if (value instanceof Double || value instanceof Float) {
        return ((Number) value).doubleValue();
      } else {
        return ((Number) value).longValue();
      }
    } else if (value instanceof boolean[]) {
      JSONArray array = new JSONArray();
      for (boolean arrValue : (boolean[]) value) {
        array.put(getJSONValue(arrValue));
      }
      return array;
    } else if (value instanceof char[]) {
      JSONArray array = new JSONArray();
      for (char arrValue : (char[]) value) {
        array.put(getJSONValue(arrValue));
      }
      return array;
    } else if (value instanceof CharSequence[]) {
      JSONArray array = new JSONArray();
      for (CharSequence arrValue : (CharSequence[]) value) {
        array.put(getJSONValue(arrValue));
      }
      return array;
    } else if (value instanceof double[]) {
      JSONArray array = new JSONArray();
      for (double arrValue : (double[]) value) {
        array.put(getJSONValue(arrValue));
      }
      return array;
    } else if (value instanceof float[]) {
      JSONArray array = new JSONArray();
      for (float arrValue : (float[]) value) {
        array.put(getJSONValue(arrValue));
      }
      return array;
    } else if (value instanceof int[]) {
      JSONArray array = new JSONArray();
      for (int arrValue : (int[]) value) {
        array.put(getJSONValue(arrValue));
      }
      return array;
    } else if (value instanceof long[]) {
      JSONArray array = new JSONArray();
      for (long arrValue : (long[]) value) {
        array.put(getJSONValue(arrValue));
      }
      return array;
    } else if (value instanceof short[]) {
      JSONArray array = new JSONArray();
      for (short arrValue : (short[]) value) {
        array.put(getJSONValue(arrValue));
      }
      return array;
    } else if (value instanceof String[]) {
      JSONArray array = new JSONArray();
      for (String arrValue : (String[]) value) {
        array.put(getJSONValue(arrValue));
      }
      return array;
    }
    return null;
  }
705899
function doParse(value) {
    try {
      return JSON.parse(value);
    }
    catch(ex) {
      verbose.writeln('The value was not parsed properly. Returning it as text, ' + ex.message + ', ' + value);
      return value;
    }
  }
920073
public static JSONObject getObject(JSONValue value) {
        if (value == null)
            return null;
        if (!(value instanceof JSONObject))
            throw new JSONException(NOT_AN_OBJECT);
        return (JSONObject)value;
    }
1145119
public static Optional<String> stringValue(JsonNode json, String key) {
        return Optional.ofNullable(json.findValue(key)).map(JsonNode::asText);
    }
176927
def as_text(self, is_pretty=False):
        """"""
        values = {
            'type': self._type,
            self.SERVICE_ENDPOINT: self._service_endpoint,
        }
        if self._consume_endpoint is not None:
            values[self.CONSUME_ENDPOINT] = self._consume_endpoint
        if self._values:
            # add extra service values to the dictionary
            for name, value in self._values.items():
                values[name] = value

        if is_pretty:
            return json.dumps(values, indent=4, separators=(',', ': '))

        return json.dumps(values)
789260
public static JSONValue parse(CharSequence cs) {
        ParseText p = new ParseText(cs);
        JSONValue result = parse(p);
        if (!p.skipSpaces().isExhausted())
            throw new JSONException(EXCESS_CHARS);
        return result;
    }
871996
def _get_json(value):
    """"""
    if hasattr(value, 'replace'):
        value = value.replace('\n', ' ')
    try:
        return json.loads(value)
    except json.JSONDecodeError:
        # Escape double quotes.
        if hasattr(value, 'replace'):
            value = value.replace('"', '\\"')
        # try putting the value into a string
        return json.loads('"{}"'.format(value))
89182
private static JsonObject getJsonValueAsObject(JsonValue value) {
        return (value != null && value.getValueType() == ValueType.OBJECT) ? value.asJsonObject() : null;
    }
142988
public void setFromJSON(Context context, JSONObject properties) {
        String backgroundResStr = optString(properties, Properties.background);
        if (backgroundResStr != null && !backgroundResStr.isEmpty()) {
            final int backgroundResId = getId(context, backgroundResStr, "drawable");
            setBackGround(context.getResources().getDrawable(backgroundResId, null));
        }

        setBackgroundColor(getJSONColor(properties, Properties.background_color, getBackgroundColor()));
        setGravity(optInt(properties, TextContainer.Properties.gravity, getGravity()));
        setRefreshFrequency(optEnum(properties, Properties.refresh_freq, getRefreshFrequency()));
        setTextColor(getJSONColor(properties, Properties.text_color, getTextColor()));
        setText(optString(properties, Properties.text, (String) getText()));
        setTextSize(optFloat(properties, Properties.text_size, getTextSize()));

        final JSONObject typefaceJson = optJSONObject(properties, Properties.typeface);

        if (typefaceJson != null) {
            try {
                Typeface typeface = WidgetLib.getTypefaceManager().getTypeface(typefaceJson);
                setTypeface(typeface);
            } catch (Throwable e) {
                Log.e(TAG, e, "Couldn't set typeface from properties: %s", typefaceJson);
            }
        }
    }
1115448
private JSONArray addValue( Object value, JsonConfig jsonConfig ) {
      return _addValue( processValue( value, jsonConfig ), jsonConfig );
   }