initial commit

This commit is contained in:
stleary 2020-07-18 13:05:55 -05:00
parent d14c7b9127
commit 79ff79ed70

View File

@ -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.
* * mvn clean test
* * gradlew clean 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
@ -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
```