Skip to content

Commit 192f514

Browse files
committed
1.2.0
1 parent bd17624 commit 192f514

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

README

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Overview:
3333
static Object parse(Reader reader) throws IOException, ParseException;
3434
static String stringify(Object object); // generate JSON text
3535

36-
List<String> list(); // returns list of member names
36+
List<String> listNames(); // returns list of member names
3737
boolean exists(String memberName); // alias of the inherited containsKey()
3838
Object put(String memberName, Object value); // inherited
3939
JSON set(String memberName, Object value); // create or replace member
@@ -45,7 +45,7 @@ Overview:
4545
Boolean getBoolean(String memberName, int... indices) throws ClassCastException;
4646
Object[] getArray(String memberName, int... indices) throws ClassCastException;
4747
Object remove(String memberName); // inherited
48-
JSON normalize() throws Exception;
48+
JSON normalize() throws Exception; // not required to generate JSON text
4949
String stringify(String memberName, int... indices); // stringify value or array element
5050
String toString(); // overridden, stringify JSON object
5151

dist/json-1.1.0.jar

-6.79 KB
Binary file not shown.

dist/json-1.2.0.jar

6.8 KB
Binary file not shown.

src/org/miktim/JSON.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ public String toString() {
6868
return stringify();
6969
}
7070

71+
public List<String> listNames() {
72+
return new ArrayList<>(this.keySet());
73+
}
74+
75+
// Deprecated 1.1.0
7176
public List<String> list() {
7277
return new ArrayList<>(this.keySet());
7378
}

test/json/JSONTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ public static void main(String[] args) throws Exception {
6161
.set("Byte", (byte) 0xFF);
6262
log(json);
6363

64-
log("List members: " + json.list());
65-
for (String memberName : json.list()) {
64+
log("List members: " + json.listNames());
65+
for (String memberName : json.listNames()) {
6666
if (json.get(memberName) != null) {
6767
log("\"" + memberName + "\" is instance of: "
6868
+ json.get(memberName).getClass().getSimpleName());
@@ -74,8 +74,8 @@ public static void main(String[] args) throws Exception {
7474
log("\n\rNormalized:");
7575
json = json.normalize();
7676
log(json);
77-
log("List members: " + json.list());
78-
for (String memberName : json.list()) {
77+
log("List members: " + json.listNames());
78+
for (String memberName : json.listNames()) {
7979
if (json.get(memberName) != null) {
8080
log("\"" + memberName + "\" is instance of: "
8181
+ json.get(memberName).getClass().getSimpleName());
@@ -138,7 +138,6 @@ public static void main(String[] args) throws Exception {
138138
+ " }\n"
139139
+ " } ";
140140
json = (JSON) JSON.parse(example1);
141-
log(json);
142141
log(json.get("Image"));
143142
log(json.getJSON("Image").set("Thumbnail", 256)); // replace JSON object with number
144143
log(json.getJSON("Image").remove("Thumbnail")); // remove member

0 commit comments

Comments
 (0)