title: Converting JSONArray to normal Array
body: <p>I created a a JSON Array from a normal array of user defined object.How do i convert the JSONArray back to a normal array of the user-defined type..?
  I'm using Json for shared preference in android.Using this code i found on the net:</p>
  
  <pre><code>import org.json.JSONObject;
  import org.json.JSONArray;
  import org.json.JSONException;
  
  import android.content.Context;
  import android.content.SharedPreferences;
  
  public class JSONSharedPreferences {
      private static final String PREFIX = "json";
  
      public static void saveJSONObject(Context c, String prefName, String key, JSONObject object) {
          SharedPreferences settings = c.getSharedPreferences(prefName, 0);
          SharedPreferences.Editor editor = settings.edit();
          editor.putString(JSONSharedPreferences.PREFIX+key, object.toString());
          editor.commit();
      }
  
      public static void saveJSONArray(Context c, String prefName, String key, JSONArray array) {
          SharedPreferences settings = c.getSharedPreferences(prefName, 0);
          SharedPreferences.Editor editor = settings.edit();
          editor.putString(JSONSharedPreferences.PREFIX+key, array.toString());
          editor.commit();
      }
  
      public static JSONObject loadJSONObject(Context c, String prefName, String key) throws JSONException {
          SharedPreferences settings = c.getSharedPreferences(prefName, 0);
          return new JSONObject(settings.getString(JSONSharedPreferences.PREFIX+key, "{}"));
      }
  
      public static JSONArray loadJSONArray(Context c, String prefName, String key) throws JSONException {
          SharedPreferences settings = c.getSharedPreferences(prefName, 0);
          return new JSONArray(settings.getString(JSONSharedPreferences.PREFIX+key, "[]"));
      }
  
      public static void remove(Context c, String prefName, String key) {
          SharedPreferences settings = c.getSharedPreferences(prefName, 0);
          if (settings.contains(JSONSharedPreferences.PREFIX+key)) {
              SharedPreferences.Editor editor = settings.edit();
              editor.remove(JSONSharedPreferences.PREFIX+key);
              editor.commit();
          }
      }
  }
  </code></pre>
  
  <p>I'm trying to convert a user defined object array into jsonarray and storing it in jsonshared preference and later trying to retrive it.Having problem knowing how to retrive it.
  Thanks.</p>