//package com.xiledsystems.AlternateJavaBridgelib;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
/**
*
* This was mostly copied from com.google.devtools.simple.runtime.components.util.JsonUtil. It has been modified to not
* use the FString, or Yaillist classes (so Kawa library not needed)
*
* - Ryan Bis - www.xiledsystems.com
*
*/
class JsonUtil2 {
/**
* Prevent instantiation.
*/
private JsonUtil2() {
}
/**
* Returns a list of String objects from a JSONArray. This
* does not do any kind of recursive unpacking of the array.
* Thus, if the array includes other JSON arrays or JSON objects
* their string representation will be a single item in the
* returned list.
*
* @param jArray The JSONArray to convert.
* @return A List of the String representation of each item in
* the JSON array.
* @throws JSONException if an element of jArray cannot be
* converted to a String.
*/
public static List getStringListFromJsonArray(JSONArray jArray) throws JSONException {
List returnList = new ArrayList();
for (int i = 0; i < jArray.length(); i++) {
String val = jArray.getString(i);
returnList.add(val);
}
return returnList;
}
/**
* Returns a Java Object list of a JSONArray with each item in
* the array converted using convertJsonItem().
*
* @param jArray The JSONArray to convert.
* @return A List of Strings and more Object lists.
* @throws JSONException if an element in jArray cannot be
* converted properly.
*/
public static List