|
@@ -0,0 +1,39 @@
|
|
|
+/*
|
|
|
+ * To change this license header, choose License Headers in Project Properties.
|
|
|
+ * To change this template file, choose Tools | Templates
|
|
|
+ * and open the template in the editor.
|
|
|
+ */
|
|
|
+package jsontest;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import org.json.*;
|
|
|
+
|
|
|
+/**
|
|
|
+ *
|
|
|
+ * @author Loquicom <contact@loquicom.fr>
|
|
|
+ */
|
|
|
+public class JsonTest {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param args the command line arguments
|
|
|
+ */
|
|
|
+ public static void main(String[] args) {
|
|
|
+ JSONObject jo = new JSONObject();
|
|
|
+ Test t = new Test();
|
|
|
+ ArrayList<Boolean> tab = new ArrayList<>();
|
|
|
+ tab.add(true);
|
|
|
+ tab.add(false);
|
|
|
+ tab.add(true);
|
|
|
+ tab.add(true);
|
|
|
+
|
|
|
+ jo.put("bool", true);
|
|
|
+ jo.put("tab", tab);
|
|
|
+ jo.put("obj", t.toJson());
|
|
|
+ jo.put("int", 89);
|
|
|
+ jo.put("nb", 42.6);
|
|
|
+
|
|
|
+ System.out.println(jo.toString(1));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|