Skip to content

Commit d91e59e

Browse files
committed
updating JSON example
1 parent 331e465 commit d91e59e

5 files changed

Lines changed: 5 additions & 208 deletions

File tree

java/examples/Topics/Advanced Data/LoadSaveJSON/LoadSaveJSON.pde

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff 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

java/examples/Topics/Advanced Data/LoadSaveJSONTest/Bubble.pde

Lines changed: 0 additions & 40 deletions
This file was deleted.

java/examples/Topics/Advanced Data/LoadSaveJSONTest/LoadSaveJSONTest.pde

Lines changed: 0 additions & 126 deletions
This file was deleted.
Binary file not shown.

java/examples/Topics/Advanced Data/LoadSaveJSONTest/data/data.json

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)