@Override @SuppressWarnings("unchecked") public Map<String, Object> toJsonNode(final Object value) throws Exception { PipedReader in = new PipedReader(); final PipedWriter out = new PipedWriter(in); Executors.newSingleThreadExecutor().execute(() -> toJson(value, out)); return (Map<String, Object>) this.slurper.parse(in); }
/** * Parse a JSON data structure from content within a given File. * * @param file File containing JSON content * @param charset the charset for this File * @return a data structure of lists and maps * @since 2.2.0 */ public Object parse(File file, String charset) { return parseFile(file, charset); }
/** * Parse a JSON data structure from content at a given URL. * * @param url URL containing JSON content * @param params connection parameters * @param charset the charset for this File * @return a data structure of lists and maps * @since 2.2.0 */ public Object parse(URL url, Map params, String charset) { return parseURL(url, params, charset); }
private Object parseURL(URL url, Map params, String charset) { return parse(new StringReader( HTTP.getJSONWithParams ( url.toString (), null, params ))); } }
/** * Parse a JSON data structure from content at a given URL. Convenience variant when using Groovy named parameters for the connection params. * * @param params connection parameters * @param url URL containing JSON content * @param charset the charset for this File * @return a data structure of lists and maps * @since 2.2.0 */ public Object parse(Map params, URL url, String charset) { return parseURL(url, params, charset); }
/** * Parse a JSON data structure from content within a given File. * * @param file File containing JSON content * @param charset the charset for this File * @return a data structure of lists and maps * @since 2.2.0 */ public Object parse(File file, String charset) { return parseFile(file, charset); }
private Object parseURL(URL url, Map params, String charset) { return parse(new StringReader( HTTP.getJSONWithParams ( url.toString (), null, params ))); } }
/** * Parse a JSON data structure from content at a given URL. * * @param url URL containing JSON content * @param params connection parameters * @return a data structure of lists and maps * @since 2.2.0 */ public Object parse(URL url, Map params) { return parseURL(url, params); }
/** * Parse a JSON data structure from content within a given File. * * @param file File containing JSON content * @return a data structure of lists and maps * @since 2.2.0 */ public Object parse(File file) { return parseFile(file, null); }
private Object parseURL(URL url, Map params) { return parse(new StringReader ( IO.read ( url.toString () ))); }
/** * Parse a JSON data structure from content at a given URL. Convenience variant when using Groovy named parameters for the connection params. * * @param params connection parameters * @param url URL containing JSON content * @return a data structure of lists and maps * @since 2.2.0 */ public Object parse(Map params, URL url) { return parseURL(url, params); }
/** * Parse a JSON data structure from content within a given File. * * @param file File containing JSON content * @return a data structure of lists and maps * @since 2.2.0 */ public Object parse(File file) { return parseFile(file, null); }
private Object parseURL(URL url, Map params) { return parse(new StringReader ( IO.read ( url.toString () ))); }
/** * Parse a JSON data structure from content at a given URL. * * @param url URL containing JSON content * @param params connection parameters * @return a data structure of lists and maps * @since 2.2.0 */ public Object parse(URL url, Map params) { return parseURL(url, params); }
/** * Parse a JSON data structure from content within a given File. * * @param file File containing JSON content * @return a data structure of lists and maps * @since 2.2.0 */ public Object parse(File file) { return parseFile(file, null); }
private Object parseURL(URL url, Map params, String charset) { return parse(new StringReader( HTTP.getJSONWithParams ( url.toString (), null, params ))); } }
/** * Parse a JSON data structure from content at a given URL. * * @param url URL containing JSON content * @param params connection parameters * @param charset the charset for this File * @return a data structure of lists and maps * @since 2.2.0 */ public Object parse(URL url, Map params, String charset) { return parseURL(url, params, charset); }
/** * Parse a JSON data structure from content within a given File. * * @param file File containing JSON content * @param charset the charset for this File * @return a data structure of lists and maps * @since 2.2.0 */ public Object parse(File file, String charset) { return parseFile(file, charset); }
private Object parseURL(URL url, Map params) { return parse(new StringReader ( IO.read ( url.toString () ))); }
/** * Parse a JSON data structure from content at a given URL. Convenience variant when using Groovy named parameters for the connection params. * * @param params connection parameters * @param url URL containing JSON content * @return a data structure of lists and maps * @since 2.2.0 */ public Object parse(Map params, URL url) { return parseURL(url, params); }