1 package jalview.javascript.json;
3 import java.io.BufferedReader;
4 import java.io.InputStream;
9 * A rudimentary JSON converter/iterator that uses the browser's native AJAX
10 * json data type delivery mechanism.
12 * Arrays are delivered as ArrayList<Object> where Object may be Boolean,
13 * String, Long, Double, ArrayList, and "Map-like object".
15 * For speed, the maps returned are just JavaScript maps with a few added
16 * methods for extracting data. [get(), contains(), probably should add keySet,
17 * valueSet, and entrySet].
19 * @author hansonr Bob Hanson St. Olaf College 1/24/2019
26 * A simple encoding of sequential key/value pairs for a jQuery.ajax call. If
27 * the first key is "url" and the second is an object, then the ajax object is
28 * attached to that url as well, just for transport purposes within the
32 * assumed to be simple String,Object pairs. String objects will be
33 * surrounded by double quotes.
35 @SuppressWarnings("static-access")
36 public static Object setAjax(Object... keyValues)
38 return /** @j2sNative swingjs.JSUtil.setAjax$OA(keyValues) || */
42 public static void setAjax(URL url)
44 /** @j2sNative swingjs.JSUtil.setAjax$java_net_URL(url); */
47 public static BufferedReader getJSONReader(InputStream is)
49 return /** @j2sNative swingjs.JSUtil.getJSONReader$O(is) || */
56 * as String, Reader, InputStream, or JavaScript Object or Array
59 public static Object parse(Object obj)
61 return /** @j2sNative swingjs.JSUtil.parseJSON$O(obj) || */
65 public static String stringify(Object obj)
67 return /** @j2sNative swingjs.JSUtil.stringifyJSON$O(obj) || */