private Object requireJsonModule() { exports = JSON.decode(script); return exports; }
public Object deserialize(String string) { return JSON.decode(string); }
public Object decode(String s) { return JSON.decode(s); } }
protected Input parse(String line) { return JSON.decode(line, Input.class); }
/** * Parse the json string and returns the result as {@link JsonValue}. */ public static JsonValue parse(String json) { return JsonValue.of(decode(json)); }
/** * Parse the response content as json and decodes to the given type. */ default <T> T decodeJson(Class<T> type) { return JSON.decode(getContent(), type); }
protected T doConvert(String s) { if(null == s || s.length() == 0) { return null; }else{ if(complex) { return JSON.decode(s, type); }else{ return Converts.convert(s, type); } } } }
/** * Returns the response body as decoded json value. */ default Object json() throws HttpIOException { return JSON.decode(getString()); }
/** * Parse the json string and returns the result as {@link JsonValue}. */ public static JsonValue parse(Reader json) { return JsonValue.of(decode(json)); }
@Override public Object deserialize(FieldMapping fm, Object encoded) { return JSON.decode(toString(encoded)); }
@Override public T getObject() { if(t != null){ return t; }else if (clzz != null){ if(m != null){ t = JSON.decode(JSON.encode(m),clzz); } return t; }else { return (T)m; } } }
@Override public Object deserialize(FieldMapping fm, Object encoded, Class<?> type, Type genericType) { return JSON.decode(toString(encoded), type, genericType); }
public Object decode(String encoded) { return Strings.isEmpty(encoded) ? null : JSON.decode(encoded); }
public Object tryDeserialize(String string) { if(Strings.isEmpty(string)){ return null; } string = string.trim(); if("null".equals(string)){ return null; } if((string.startsWith("[") && string.endsWith("]")) || (string.startsWith("{") && string.endsWith("}"))){ return JSON.decode(string); } return string; } }
public void read(MetaApi api, Resource resource) { Map<String, MetaField> map = (Map<String,MetaField>)JSON.decode(resource.getContent(), field.getType(), field.getGenericType()); api.getDomains().putAll(map); }
@Override public ApiMetadataBuilder read(Reader reader) throws IOException { String content = IO.readString(reader).trim(); Map<String,Object> swagger; if(content.startsWith("{")) { swagger = JSON.decode(content); }else{ swagger = YAML.decode(content); } ApiMetadataBuilder m = new ApiMetadataBuilder(); readSwagger(swagger, m); return m; }
private void loadResource(Resource resource) { Dbms mdb = JSON.decode(resource.getContent(), Dbms.class); beanValidator.validate(mdb); log.debug("Load database '{}', drive class name : {}", mdb.getName(), mdb.getDriverClassName()); map.put(mdb.getName().toLowerCase(), mdb); } }
@Override public <T> Property<T> getDynaProperty(String name, Class<T> type) { if(null != propertyProvider) { try { Property<T> p = propertyProvider.getDynaProperty(name, type); return p; } catch (UnsupportedDynaPropertyException e) { log.info("property {0} unsupported by {1}, use local config",name,propertyProvider.getClass()); } } String v = properties.get(name); if(null == v || v.isEmpty()) { return new NullProperty<>(); } TypeInfo ti = Types.getTypeInfo(type,null); if(ti.isComplexType()) { return new SimpleProperty<>(type, JSON.decode(v, type)); }else{ return new SimpleProperty<>(type, Converts.convert(v, type)); } }
public Expression convertToExpr(String value) { if(EL.hasPrefixAndSuffix(value)) { return el.createExpression(EL.removePrefixAndSuffix(value)); } if(vars.checkVariableExists(value)) { return new VariableExpression(vars, value); } int dotIndex = value.indexOf('.'); if(dotIndex > 0) { String name = value.substring(0, dotIndex); if(vars.checkVariableExists(name)) { return el.createExpression(VariableExpression.ENV_PREFIX + value); } } try { return new ValuedExpression(JSON.decode(value)); }catch (Exception e) { return new ValuedExpression(value); } }
public void read(MetaApi api, Resource resource, boolean global) { JsonValue v = JsonValue.of(JSON.decode(resource.getContent())); String path = !global ? PathDefParser.path("/app/operations/", resource) : null; if(v.isObject()) { read(api, global, path,(Map)v.raw()); }else if(v.isArray()) { for(Object map : v.asArray()) { read(api, global, path,(Map)map); } }else { throw new IllegalStateException("Invalid json format of tags, must be an array or an object"); } }