Org-json-jsonarray

提供:Dev Guides
移動先:案内検索

org.json-JSONArray

JSONArrayは、値の順序付けられたシーケンスです。 インデックスによって値にアクセスし、値を書き込むメソッドを提供します。 次のタイプがサポートされています-

  • ブール値
  • JSONArray
  • JSONObject
  • ひも
  • JSONObject.NULLオブジェクト

import org.json.JSONArray;
import org.json.JSONObject;

public class JSONDemo {
   public static void main(String[] args) {
      JSONArray list = new JSONArray();

      list.put("foo");
      list.put(new Integer(100));
      list.put(new Double(1000.21));
      list.put(new Boolean(true));
      list.put(JSONObject.NULL);

      System.out.println("JSONArray: ");
      System.out.println(list);
   }
}

出力

JSONArray:
["foo",100,1000.21,true,null]