Skip to content

Commit a65d4ca

Browse files
author
Andreas Göransson
committed
Oops, bad update of readme.
1 parent a58ead0 commit a65d4ca

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

README.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,83 +16,83 @@ You can still find the OLD versions [here](https://github.com/agoransson/JSON-pr
1616

1717
# Getting started with JSON in Processing.
1818

19-
**Creating a JSONObject with primitive members**
19+
**Creating a JSON with primitive members**
2020

2121
``` java
2222
/**
23-
* Creating a JSONObject with primitive members
23+
* Creating a JSON with primitive members
2424
*/
2525

26-
JSONObject obj = new JSONObject();
27-
obj.put("myint", 5);
28-
obj.put("myfloat", 5.5);
26+
JSON obj = JSON.createObject();
27+
obj.setInt("myint", 5);
28+
obj.setFloat("myfloat", 5.5);
2929

3030
println( obj );
3131
```
3232

33-
**Creating a JSONObject with complex members**
33+
**Creating a JSON with complex members**
3434

3535
``` java
3636
/**
37-
* Creating a JSONObject with complex members
37+
* Creating a JSON with complex members
3838
*/
39-
JSONObject myfirstmember = new JSONObject();
40-
myfirstmember.put("myint", 5);
39+
JSON myfirstmember = JSON.createObject();
40+
myfirstmember.setInt("myint", 5);
4141

42-
JSONObject mysecondmember = new JSONObject();
43-
mysecondmember.put("myfloat", 5.5);
42+
JSON mysecondmember = JSON.createObject();
43+
mysecondmember.setFloat("myfloat", 5.5);
4444

45-
JSONObject obj = new JSONObject();
46-
obj.put("myobj", myfirstmember);
47-
obj.put("myobj2", mysecondmember);
45+
JSON obj = JSON.createObject();
46+
obj.setJSON("myobj", myfirstmember);
47+
obj.setJSON("myobj2", mysecondmember);
4848

4949
println( obj );
5050
```
5151

52-
**Creating a JSONObject from a json-formatted String.**
52+
**Creating a JSON from a json-formatted String.**
5353

5454
``` java
5555
/**
56-
* Creating a JSONObject from a json-formatted String.
56+
* Creating a JSON from a json-formatted String.
5757
*/
5858
String json_formatted_string = "{\"myint\":5,\"myfloat\":5.5}";
59-
JSONObject obj = new JSONObject(json_formatted_string);
59+
JSON obj = JSON.parse(json_formatted_string);
6060
println( obj );
6161
```
6262

63-
**Creating a JSONArray of primitives**
63+
**Creating a JSON array of primitives**
6464

6565
``` java
6666
/**
67-
* Creating a JSONArray of primitives
67+
* Creating a JSON array of primitives
6868
*/
69-
JSONArray arr = new JSONArray();
70-
arr.put(5);
71-
arr.put(5.5);
72-
arr.put('a');
69+
JSON arr = JSON.createArray();
70+
arr.append(5);
71+
arr.append(5.5);
72+
arr.append('a');
7373

7474
println(arr);
7575
```
7676

77-
**Creating a JSONArray of objects**
77+
**Creating a JSON array of objects**
7878

7979
``` java
8080
/**
81-
* Creating a JSONArray of objects
81+
* Creating a JSON array of objects
8282
*/
83-
JSONObject first = new JSONObject();
84-
first.put("val", 5);
83+
JSON first = JSON.createObject();
84+
first.setInt("val", 5);
8585

86-
JSONObject sec = new JSONObject();
87-
sec.put("val", 5.5);
86+
JSON sec = JSON.createObject();
87+
sec.setFloat("val", 5.5);
8888

89-
JSONObject third = new JSONObject();
90-
third.put("val", 'a');
89+
JSON third = JSON.createObject();
90+
third.setString("val", "a");
9191

92-
JSONArray arr = new JSONArray();
93-
arr.put(first);
94-
arr.put(sec);
95-
arr.put(third);
92+
JSON arr = JSON.createArray();
93+
arr.append(first);
94+
arr.append(sec);
95+
arr.append(third);
9696

9797
println(arr);
9898
```

0 commit comments

Comments
 (0)