@@ -4481,6 +4481,105 @@ public boolean saveXML(XML xml, String filename, String options) {
4481
4481
}
4482
4482
4483
4483
4484
+ /**
4485
+ * @webref input:files
4486
+ * @param input String to parse as a JSONObject
4487
+ * @see PApplet#loadJSONObject(String)
4488
+ * @see PApplet#saveJSONObject(JSONObject, String)
4489
+ */
4490
+ public JSONObject parseJSONObject (String input ) {
4491
+ return new JSONObject (new StringReader (input ));
4492
+ }
4493
+
4494
+
4495
+ /**
4496
+ * @webref input:files
4497
+ * @param filename name of a file in the data folder or a URL
4498
+ * @see JSONObject
4499
+ * @see JSONArray
4500
+ * @see PApplet#loadJSONArray(String)
4501
+ * @see PApplet#saveJSONObject(JSONObject, String)
4502
+ * @see PApplet#saveJSONArray(JSONArray, String)
4503
+ */
4504
+ public JSONObject loadJSONObject (String filename ) {
4505
+ return new JSONObject (createReader (filename ));
4506
+ }
4507
+
4508
+
4509
+ static public JSONObject loadJSONObject (File file ) {
4510
+ return new JSONObject (createReader (file ));
4511
+ }
4512
+
4513
+
4514
+ /**
4515
+ * @webref output:files
4516
+ * @see JSONObject
4517
+ * @see JSONArray
4518
+ * @see PApplet#loadJSONObject(String)
4519
+ * @see PApplet#loadJSONArray(String)
4520
+ * @see PApplet#saveJSONArray(JSONArray, String)
4521
+ */
4522
+ public boolean saveJSONObject (JSONObject json , String filename ) {
4523
+ return saveJSONObject (json , filename , null );
4524
+ }
4525
+
4526
+
4527
+ /**
4528
+ * @nowebref
4529
+ */
4530
+ public boolean saveJSONObject (JSONObject json , String filename , String options ) {
4531
+ return json .save (saveFile (filename ), options );
4532
+ }
4533
+
4534
+
4535
+ /**
4536
+ * @webref input:files
4537
+ * @param input String to parse as a JSONArray
4538
+ * @see JSONObject
4539
+ * @see PApplet#loadJSONObject(String)
4540
+ * @see PApplet#saveJSONObject(JSONObject, String)
4541
+ */
4542
+ public JSONArray parseJSONArray (String input ) {
4543
+ return new JSONArray (new StringReader (input ));
4544
+ }
4545
+
4546
+
4547
+ /**
4548
+ * @webref input:files
4549
+ * @param filename name of a file in the data folder or a URL
4550
+ * @see JSONArray
4551
+ * @see PApplet#loadJSONObject(String)
4552
+ * @see PApplet#saveJSONObject(JSONObject, String)
4553
+ * @see PApplet#saveJSONArray(JSONArray, String)
4554
+ */
4555
+ public JSONArray loadJSONArray (String filename ) {
4556
+ return new JSONArray (createReader (filename ));
4557
+ }
4558
+
4559
+
4560
+ static public JSONArray loadJSONArray (File file ) {
4561
+ return new JSONArray (createReader (file ));
4562
+ }
4563
+
4564
+
4565
+ /**
4566
+ * @webref output:files
4567
+ * @see JSONObject
4568
+ * @see JSONArray
4569
+ * @see PApplet#loadJSONObject(String)
4570
+ * @see PApplet#loadJSONArray(String)
4571
+ * @see PApplet#saveJSONObject(JSONObject, String)
4572
+ */
4573
+ public boolean saveJSONArray (JSONArray json , String filename ) {
4574
+ return saveJSONArray (json , filename , null );
4575
+ }
4576
+
4577
+
4578
+ public boolean saveJSONArray (JSONArray json , String filename , String options ) {
4579
+ return json .save (saveFile (filename ), options );
4580
+ }
4581
+
4582
+
4484
4583
public Table createTable () {
4485
4584
return new Table ();
4486
4585
}
0 commit comments