-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
21b3545
commit 5264a32
Showing
3 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,40 @@ | ||
# JJParser | ||
Java JSON Parser - parser and correct a JSON object according to a given JSON schema | ||
|
||
JJParser stands for JAVA JSON Parser which rectifies your JSON input according to a given schema. | ||
|
||
- Support JSON schema draft 07 | ||
- Structure and data type correction | ||
- Written in Java | ||
- Only depended on Google gson | ||
|
||
# Sample usage | ||
> To demonstrate the functionality, let's choose a JSON input string | ||
> which needs both data type and structural corrections. | ||
```java | ||
String schema = "{\n" + | ||
" \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n" + | ||
" \"type\": \"object\",\n" + | ||
" \"properties\": {\n" + | ||
" \"singleObjArray\": {\n" + | ||
" \"type\": \"array\",\n" + | ||
" \"items\": [{\"type\": \"number\"}]\n" + | ||
" }\n" + | ||
" }\n" + | ||
"}"; | ||
String inputJson = "{\"singleObjArray\":\"1.618\"}"; | ||
String result = JavaJsonParser.parseJson(inputJson, schema); | ||
System.out.println(result); | ||
``` | ||
Which will give the following corrected output | ||
```java | ||
{"singleObjArray":[1.618]} | ||
``` | ||
### Development | ||
|
||
Want to contribute? Great! | ||
|
||
You can contribute by | ||
* Adding test cases. | ||
* Reporting issues. | ||
* Updating the project with latest schema changes. | ||
* Add currently unsupported properties like "instaceOf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters