Skip to content

Commit f88105b

Browse files
committed
1.2.1
1 parent 00ef9a9 commit f88105b

File tree

6 files changed

+8
-6
lines changed

6 files changed

+8
-6
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
MIT License
2-
2+
33
Copyright (c) 2020-2022 miktim@mail.ru
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy

README

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ Release notes:
1111
- AVOID RECURSION!;
1212
- in addition, the generator converts Java Lists,Sets to JSON arrays, Java Maps to JSON objects.
1313
The null key is converted to a "null" member name.
14-
Other Java objects are converted to JSON strings.
14+
Other Java objects are converted to JSON strings;
15+
- JSON JavaScript - like interface.
1516

1617
Put, set, get notes:
1718
- put, set methods casts Java primitives to the corresponding objects.
@@ -50,7 +51,7 @@ Overview:
5051

5152
JSON normalize() throws Exception; // not required to generate JSON text
5253

53-
String stringify(String memberName, int... indices); // stringify value or array element
54+
String toString(String memberName, int... indices); // stringify value or array element
5455
String toString(); // overridden, stringify JSON object
5556

5657
Usage: see ./test/json/JSONTest.java

dist/json-1.2.0.jar

-6.86 KB
Binary file not shown.

dist/json-1.2.1.jar

6.86 KB
Binary file not shown.

src/org/miktim/JSON.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public String stringify() {
5959
return stringify(this);
6060
}
6161

62-
public String stringify(String memberName, int... indices) {
62+
public String toString(String memberName, int... indices) {
6363
return JSON.stringify(get(memberName, indices));
6464
}
6565

@@ -72,7 +72,7 @@ public List<String> listNames() {
7272
return new ArrayList<>(this.keySet());
7373
}
7474

75-
// Deprecated in 1.2.0
75+
// Deprecated 1.2.0
7676
@Deprecated
7777
public List<String> list() {
7878
return new ArrayList<>(this.keySet());

test/json/JSONTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static void main(String[] args) throws Exception {
3535
log(json.getNumber("One").floatValue()); // Number(Integer)
3636
// java.lang.ClassCastException
3737
// log(json.getString("Two"));
38-
log(json.stringify("Two"));
38+
log(json.toString("Two"));
3939
log(json.getString("3"));
4040
log(json.getJSON("Nested").getNumber("Array", 1, 1).intValue());
4141

@@ -94,6 +94,7 @@ public static void main(String[] args) throws Exception {
9494
log(json.getNumber("Array", 1, 1).floatValue());
9595

9696
log(json = json.normalize());
97+
9798
log(json.get("Array").getClass().getSimpleName());
9899
// array is instance of Object[]
99100
log(json.getNumber("Array", 1, 1).floatValue());

0 commit comments

Comments
 (0)