File tree Expand file tree Collapse file tree
java/examples/Topics/Advanced Data Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ void draw() {
5555 void loadData () {
5656 // Load JSON file
5757 // Temporary full path until path problem resolved.
58- json = loadJSONObject(" /Users/shiffman/Desktop/LoadSaveJSON/data/ data.json" );
58+ json = loadJSONObject(" data.json" );
5959
6060 JSONArray bubbleData = json. getJSONArray(" bubbles" );
6161
@@ -64,7 +64,7 @@ void draw() {
6464
6565 for (int i = 0 ; i < bubbleData. size(); i++ ) {
6666 // Get each object in the array
67- JSONObject bubble = bubbleData. getObject (i);
67+ JSONObject bubble = bubbleData. getJSONObject (i);
6868 // Get a position object
6969 JSONObject position = bubble. getJSONObject(" position" );
7070 // Get x,y from position
@@ -104,9 +104,8 @@ void draw() {
104104 bubbleData. removeIndex(0 );
105105 }
106106
107- println (json);
108- // Not implemented yet
109- // saveJSONObject(json,"data.json");
110- // loadData();
107+ // Save new data
108+ saveJSONObject(json," data/data.json" );
109+ loadData();
111110}
112111
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments