private JettisonObjectIterator(org.codehaus.jettison.json.JSONObject jsonObject) { this.jsonObject = jsonObject; this.jsonKeysIt = jsonObject.keys(); }
public Collection<String> getPropertyKeys(Object obj) { List<String> keys = new ArrayList<String>(length(obj)); if( obj instanceof org.codehaus.jettison.json.JSONArray ) { for (int i = 0; i < length(obj); i++) { keys.add(String.valueOf(i)); } } if( obj instanceof org.codehaus.jettison.json.JSONObject ) { Iterator<?> keysIt = ((org.codehaus.jettison.json.JSONObject)obj).keys(); while (keysIt.hasNext()) { keys.add(String.valueOf(keysIt.next())); } } return keys; }
private JettisonObjectIterator(org.codehaus.jettison.json.JSONObject jsonObject) { this.jsonObject = jsonObject; this.jsonKeysIt = jsonObject.keys(); }
@SuppressWarnings("unchecked") static <T> Map<String, T> asMap(String jsonObjectVal) throws JSONException { if (null == jsonObjectVal) { return null; } Map<String, T> result = new HashMap<String, T>(); JSONObject sourceMap = new JSONObject(jsonObjectVal); Iterator<String> keyIterator = sourceMap.keys(); while (keyIterator.hasNext()) { String key = keyIterator.next(); result.put(key, (T)sourceMap.get(key)); } return result; }
public Collection<String> getPropertyKeys(Object obj) { List<String> keys = new ArrayList<String>(length(obj)); if( obj instanceof org.codehaus.jettison.json.JSONArray ) { for (int i = 0; i < length(obj); i++) { keys.add(String.valueOf(i)); } } if( obj instanceof org.codehaus.jettison.json.JSONObject ) { Iterator<?> keysIt = ((org.codehaus.jettison.json.JSONObject)obj).keys(); while (keysIt.hasNext()) { keys.add(String.valueOf(keysIt.next())); } } return keys; }
public Node(Node parent, String name, JSONObject object, Convention con) throws JSONException, XMLStreamException { this.parent = parent; this.object = object; /* Should really use a _Linked_ HashMap to preserve * ordering (insert order) -- regular one has arbitrary ordering. * But there are some funky dependencies within unit tests * that will fail right now, need to investigate that bit more */ this.namespaces = new LinkedHashMap(); this.attributes = new LinkedHashMap(); con.processAttributesAndNamespaces(this, object); keys = object.keys(); this.name = con.createQName(name, this); }
Iterator keys = keys(); StringBuilder sb = new StringBuilder("{");
/** * Produce a JSONArray containing the names of the elements of this * JSONObject. * @return A JSONArray containing the key strings, or null if the JSONObject * is empty. */ public JSONArray names() { JSONArray ja = new JSONArray(); Iterator keys = keys(); while (keys.hasNext()) { ja.put(keys.next()); } return ja.length() == 0 ? null : ja; }
public void processAttributesAndNamespaces(Node n, JSONObject object) throws JSONException, XMLStreamException { for (Iterator itr = object.keys(); itr.hasNext();) { String k = (String) itr.next(); for (Iterator pitr = jo.keys(); pitr.hasNext(); ) { String prefix = (String) pitr.next(); String uri = jo.getString(prefix);
return "{}"; Iterator keys = keys(); StringBuilder sb = new StringBuilder("{"); int newindent = indent + indentFactor;
public BadgerFishXMLStreamReader(JSONObject obj) throws JSONException, XMLStreamException { String rootName = (String) obj.keys().next(); this.node = new Node(null, rootName, obj.getJSONObject(rootName), CONVENTION); this.nodes = new FastStack(); nodes.push(node); event = START_DOCUMENT; }
public MappedXMLStreamReader(JSONObject obj, MappedNamespaceConvention con) throws JSONException, XMLStreamException { String rootName = (String) obj.keys().next(); this.convention = con; this.nodes = new FastStack(); this.ctx = con; Object top = obj.get(rootName); if (top instanceof JSONObject) { this.node = new Node(null, rootName, (JSONObject)top, convention); } else if (top instanceof JSONArray && !(((JSONArray)top).length() == 1 && ((JSONArray)top).get(0).equals(""))) { this.node = new Node(null, rootName, obj, convention); } else { node = new Node(rootName, convention); convention.processAttributesAndNamespaces(node, obj); currentValue = JSONObject.NULL.equals(top) ? null : top.toString(); } nodes.push(node); event = START_DOCUMENT; }
@SuppressWarnings("unchecked") public static Iterator<String> getStringKeys(JSONObject json) { return json.keys(); } }
private JettisonObjectIterator(org.codehaus.jettison.json.JSONObject jsonObject) { this.jsonObject = jsonObject; this.jsonKeysIt = jsonObject.keys(); }
String theKey = jsonObject.keys().next().toString(); if (lastKey == null || lastKey.equals(theKey)) { lastKey = theKey;
@Override public Map<String, CimFieldInfo> parse(JSONObject json) throws JSONException { final Map<String, CimFieldInfo> res = Maps.newHashMapWithExpectedSize(json.length()); final Iterator keysIterator = json.keys(); while (keysIterator.hasNext()) { final String id = (String) keysIterator.next(); res.put(id, parseIssueFieldInfo(json.getJSONObject(id), id)); } return res; }
public Transition parse(JSONObject json) throws JSONException { final int id = json.getInt("id"); final String name = json.getString("name"); final JSONObject fieldsObj = json.getJSONObject("fields"); final Iterator keys = fieldsObj.keys(); final Collection<Transition.Field> fields = Lists.newArrayList(); while (keys.hasNext()) { final String fieldId = keys.next().toString(); fields.add(transitionFieldJsonParser.parse(fieldsObj.getJSONObject(fieldId), fieldId)); } return new Transition(name, id, fields); }
public Transition parse(JSONObject json) throws JSONException { final int id = json.getInt("id"); final String name = json.getString("name"); final JSONObject fieldsObj = json.getJSONObject("fields"); final Iterator keys = fieldsObj.keys(); final Collection<Transition.Field> fields = Lists.newArrayList(); while(keys.hasNext()) { final String fieldId = keys.next().toString(); fields.add(transitionFieldJsonParser.parse(fieldsObj.getJSONObject(fieldId), fieldId)); } return new Transition(name, id, fields); }