@@ -4514,6 +4514,105 @@ public boolean saveXML(XML xml, String filename, String options) {
4514
4514
}
4515
4515
4516
4516
4517
+ /**
4518
+ * @webref input:files
4519
+ * @param input String to parse as a JSONObject
4520
+ * @see PApplet#loadJSONObject(String)
4521
+ * @see PApplet#saveJSONObject(JSONObject, String)
4522
+ */
4523
+ public JSONObject parseJSONObject (String input ) {
4524
+ return new JSONObject (new StringReader (input ));
4525
+ }
4526
+
4527
+
4528
+ /**
4529
+ * @webref input:files
4530
+ * @param filename name of a file in the data folder or a URL
4531
+ * @see JSONObject
4532
+ * @see JSONArray
4533
+ * @see PApplet#loadJSONArray(String)
4534
+ * @see PApplet#saveJSONObject(JSONObject, String)
4535
+ * @see PApplet#saveJSONArray(JSONArray, String)
4536
+ */
4537
+ public JSONObject loadJSONObject (String filename ) {
4538
+ return new JSONObject (createReader (filename ));
4539
+ }
4540
+
4541
+
4542
+ static public JSONObject loadJSONObject (File file ) {
4543
+ return new JSONObject (createReader (file ));
4544
+ }
4545
+
4546
+
4547
+ /**
4548
+ * @webref output:files
4549
+ * @see JSONObject
4550
+ * @see JSONArray
4551
+ * @see PApplet#loadJSONObject(String)
4552
+ * @see PApplet#loadJSONArray(String)
4553
+ * @see PApplet#saveJSONArray(JSONArray, String)
4554
+ */
4555
+ public boolean saveJSONObject (JSONObject json , String filename ) {
4556
+ return saveJSONObject (json , filename , null );
4557
+ }
4558
+
4559
+
4560
+ /**
4561
+ * @nowebref
4562
+ */
4563
+ public boolean saveJSONObject (JSONObject json , String filename , String options ) {
4564
+ return json .save (saveFile (filename ), options );
4565
+ }
4566
+
4567
+
4568
+ /**
4569
+ * @webref input:files
4570
+ * @param input String to parse as a JSONArray
4571
+ * @see JSONObject
4572
+ * @see PApplet#loadJSONObject(String)
4573
+ * @see PApplet#saveJSONObject(JSONObject, String)
4574
+ */
4575
+ public JSONArray parseJSONArray (String input ) {
4576
+ return new JSONArray (new StringReader (input ));
4577
+ }
4578
+
4579
+
4580
+ /**
4581
+ * @webref input:files
4582
+ * @param filename name of a file in the data folder or a URL
4583
+ * @see JSONArray
4584
+ * @see PApplet#loadJSONObject(String)
4585
+ * @see PApplet#saveJSONObject(JSONObject, String)
4586
+ * @see PApplet#saveJSONArray(JSONArray, String)
4587
+ */
4588
+ public JSONArray loadJSONArray (String filename ) {
4589
+ return new JSONArray (createReader (filename ));
4590
+ }
4591
+
4592
+
4593
+ static public JSONArray loadJSONArray (File file ) {
4594
+ return new JSONArray (createReader (file ));
4595
+ }
4596
+
4597
+
4598
+ /**
4599
+ * @webref output:files
4600
+ * @see JSONObject
4601
+ * @see JSONArray
4602
+ * @see PApplet#loadJSONObject(String)
4603
+ * @see PApplet#loadJSONArray(String)
4604
+ * @see PApplet#saveJSONObject(JSONObject, String)
4605
+ */
4606
+ public boolean saveJSONArray (JSONArray json , String filename ) {
4607
+ return saveJSONArray (json , filename , null );
4608
+ }
4609
+
4610
+
4611
+ public boolean saveJSONArray (JSONArray json , String filename , String options ) {
4612
+ return json .save (saveFile (filename ), options );
4613
+ }
4614
+
4615
+
4517
4616
public Table createTable () {
4518
4617
return new Table ();
4519
4618
}
0 commit comments