From de4395dc5ec1fdc62b81a115a9766cac21695b3b Mon Sep 17 00:00:00 2001 From: stleary Date: Sat, 18 Jul 2020 12:59:34 -0500 Subject: [PATCH 1/5] initial commit --- README.md | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8a589544d..c99ba12b7 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,49 @@ package. The package compiles on Java 1.6-1.8. -# With commit [#515 Merge tests and pom and code](https://github.com/stleary/JSON-java/pull/515), the structure of the project has changed from a flat directory containing all of the Java files to a directory structure that includes unit tests. If you have difficulty using the new structure, please open an issue so we can work through it. +** Recently [#515 Merge tests and pom and code](https://github.com/stleary/JSON-java/pull/515), the structure of the project changed from a flat directory containing all of the Java files to a directory structure that includes unit tests and several build tools to build the project jar and run the unit tests. If you have difficulty using the new structure, please open an issue so we can work through it. + +** Building from the command line + +* Build the class files from the package root directory src/main/java + +* * javac org\json\*.java + +* Build the jar file + +* * jar cf json-java.jar org/json/*.class + +* Compile a program that uses the jar (see below example code) + +* * javac -cp .;json-java.jar Test.java + +* Excecute the Test file + +* * java -cp .;json-java.jar Test + + +* Test file contents + +```` +import org.json.JSONObject; +public class Test { + public static void main(String args[]){ + JSONObject jo = new JSONObject("{ \"abc\" : \"def\" }"); + System.out.println(jo.toString()); + } +} +```` + +* Expected output + +```` +{"abc":"def"} +```` + + +You can only run the unit tests with Maven or Gradlew. + + From d14c7b91274f6468097873f2a9be2041b0ae5f28 Mon Sep 17 00:00:00 2001 From: stleary Date: Sat, 18 Jul 2020 13:02:51 -0500 Subject: [PATCH 2/5] formatting --- README.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c99ba12b7..5e2a146f6 100644 --- a/README.md +++ b/README.md @@ -22,28 +22,28 @@ package. The package compiles on Java 1.6-1.8. -** Recently [#515 Merge tests and pom and code](https://github.com/stleary/JSON-java/pull/515), the structure of the project changed from a flat directory containing all of the Java files to a directory structure that includes unit tests and several build tools to build the project jar and run the unit tests. If you have difficulty using the new structure, please open an issue so we can work through it. +**Recently [#515 Merge tests and pom and code](https://github.com/stleary/JSON-java/pull/515), the structure of the project changed from a flat directory containing all of the Java files to a directory structure that includes unit tests and several build tools to build the project jar and run the unit tests. If you have difficulty using the new structure, please open an issue so we can work through it. -** Building from the command line +**Building from the command line * Build the class files from the package root directory src/main/java * * javac org\json\*.java -* Build the jar file +*Build the jar file * * jar cf json-java.jar org/json/*.class -* Compile a program that uses the jar (see below example code) +*Compile a program that uses the jar (see below example code) * * javac -cp .;json-java.jar Test.java -* Excecute the Test file +*Excecute the Test file * * java -cp .;json-java.jar Test -* Test file contents +*Test file contents ```` import org.json.JSONObject; @@ -62,12 +62,16 @@ public class Test { ```` -You can only run the unit tests with Maven or Gradlew. +*You can only run the unit tests with Maven or Gradlew. +* * mvn clean test +* * gradlew clean test +**Files + **JSONObject.java**: The `JSONObject` can parse text from a `String` or a `JSONTokener` to produce a map-like object. The object provides methods for manipulating its contents, and for producing a JSON compliant object serialization. From 79ff79ed70c9bbd11ebf47e1300703361495d7f5 Mon Sep 17 00:00:00 2001 From: stleary Date: Sat, 18 Jul 2020 13:05:55 -0500 Subject: [PATCH 3/5] initial commit --- README.md | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 5e2a146f6..77aa248b4 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ The files in this package implement JSON encoders/decoders in Java. It also includes the capability to convert between JSON and XML, HTTP headers, Cookies, and CDL. -This is a reference implementation. There is a large number of JSON packages +This is a reference implementation. There are a large number of JSON packages in Java. Perhaps someday the Java community will standardize on one. Until then, choose carefully. @@ -22,28 +22,28 @@ package. The package compiles on Java 1.6-1.8. -**Recently [#515 Merge tests and pom and code](https://github.com/stleary/JSON-java/pull/515), the structure of the project changed from a flat directory containing all of the Java files to a directory structure that includes unit tests and several build tools to build the project jar and run the unit tests. If you have difficulty using the new structure, please open an issue so we can work through it. +Recently [#515 Merge tests and pom and code](https://github.com/stleary/JSON-java/pull/515), the structure of the project changed from a flat directory containing all of the Java files to a directory structure that includes unit tests and several build tools to build the project jar and run the unit tests. If you have difficulty using the new structure, please open an issue so we can work through it. -**Building from the command line +**Building from the command line** -* Build the class files from the package root directory src/main/java +*Build the class files from the package root directory src/main/java* * * javac org\json\*.java -*Build the jar file +*Build the jar file* * * jar cf json-java.jar org/json/*.class -*Compile a program that uses the jar (see below example code) +*Compile a program that uses the jar (see below example code)* * * javac -cp .;json-java.jar Test.java -*Excecute the Test file +*Excecute the Test file* * * java -cp .;json-java.jar Test -*Test file contents +*Test file contents* ```` import org.json.JSONObject; @@ -55,22 +55,17 @@ public class Test { } ```` -* Expected output +*Expected output* ```` {"abc":"def"} ```` -*You can only run the unit tests with Maven or Gradlew. +*You can only run the unit tests with Maven or Gradlew.* -* * mvn clean test -* * gradlew clean test - - - -**Files +#Files **JSONObject.java**: The `JSONObject` can parse text from a `String` or a `JSONTokener` to produce a map-like object. The object provides methods for manipulating its @@ -199,11 +194,11 @@ https://search.maven.org/search?q=g:org.json%20AND%20a:json&core=gav # Unit tests The test suite can be executed with Maven by running: ``` -mvn test +mvn clean test ``` -The test suite can be executed with Gradle (6.4 or greater) by running: +The test suite can be executed with Gradlew by running: ``` -gradle clean build test +gradlew clean build test ``` From 9a3e7dd7c4b7d9a970fc4fa5aa8e6ee0a6c262d6 Mon Sep 17 00:00:00 2001 From: stleary Date: Sat, 18 Jul 2020 13:08:38 -0500 Subject: [PATCH 4/5] more formatting --- README.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 77aa248b4..b4a60b9bc 100644 --- a/README.md +++ b/README.md @@ -27,20 +27,24 @@ Recently [#515 Merge tests and pom and code](https://github.com/stleary/JSON-jav **Building from the command line** *Build the class files from the package root directory src/main/java* - -* * javac org\json\*.java +```` +javac org\json\*.java +```` *Build the jar file* - -* * jar cf json-java.jar org/json/*.class +```` +jar cf json-java.jar org/json/*.class +```` *Compile a program that uses the jar (see below example code)* - -* * javac -cp .;json-java.jar Test.java +```` +javac -cp .;json-java.jar Test.java +```` *Excecute the Test file* - -* * java -cp .;json-java.jar Test +```` +java -cp .;json-java.jar Test +```` *Test file contents* @@ -65,7 +69,7 @@ public class Test { *You can only run the unit tests with Maven or Gradlew.* -#Files +#Files# **JSONObject.java**: The `JSONObject` can parse text from a `String` or a `JSONTokener` to produce a map-like object. The object provides methods for manipulating its @@ -148,7 +152,7 @@ error to be generated. Malformed JSON Texts such as missing end " (quote) on str invalid number formats (1.2e6.3) will cause errors as such documents can not be read reliably. -Some notible exceptions that the JSON Parser in this library accepts are: +Some notable exceptions that the JSON Parser in this library accepts are: * Unquoted keys `{ key: "value" }` * Unquoted values `{ "key": value }` * Unescaped literals like "tab" in string values `{ "key": "value with an unescaped tab" }` From db6ca7fbf3d36650f1f5933a3d31eff6af9d85cd Mon Sep 17 00:00:00 2001 From: stleary Date: Sat, 18 Jul 2020 13:11:13 -0500 Subject: [PATCH 5/5] even more formatting --- README.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b4a60b9bc..b8c2214ce 100644 --- a/README.md +++ b/README.md @@ -36,17 +36,11 @@ javac org\json\*.java jar cf json-java.jar org/json/*.class ```` -*Compile a program that uses the jar (see below example code)* +*Compile a program that uses the jar (see example code below)* ```` javac -cp .;json-java.jar Test.java ```` - -*Excecute the Test file* -```` -java -cp .;json-java.jar Test -```` - - + *Test file contents* ```` @@ -59,6 +53,11 @@ public class Test { } ```` +*Excecute the Test file* +```` +java -cp .;json-java.jar Test +```` + *Expected output* ```` @@ -69,7 +68,7 @@ public class Test { *You can only run the unit tests with Maven or Gradlew.* -#Files# +# Files **JSONObject.java**: The `JSONObject` can parse text from a `String` or a `JSONTokener` to produce a map-like object. The object provides methods for manipulating its