Org-json-jsonarray

提供:Dev Guides
2020年6月23日 (火) 07:47時点におけるMaintenance script (トーク | 投稿記録)による版 (Imported from text file)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先:案内検索

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]