/** * Parse the json string and returns the the array. */ public static Object[] decodeArray(Reader json){ return parse(json).asArray(); }
/** * Parse the json string and returns the the array. */ public static Object[] decodeArray(String json){ return parse(json).asArray(); }
/** * Parse the json string and returns the the array of the given type. */ public static <T> T[] decodeArray(Reader json, Class<T> componentType){ T[] a = (T[])Array.newInstance(componentType, 0); return (T[])Converts.convert(parse(json).asArray(), a.getClass(), null, convertContext); }
/** * Parse the json string and returns the the array of the given type. */ public static <T> T[] decodeArray(String json, Class<T> componentType){ T[] a = (T[])Array.newInstance(componentType, 0); return (T[])Converts.convert(parse(json).asArray(), a.getClass(), null, convertContext); }
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"); } }