Skip to content

Commit

Permalink
Release 1.0.0
Browse files Browse the repository at this point in the history
Signed-off-by: Ralph Niemitz <[email protected]>
  • Loading branch information
RalleYTN committed Jul 30, 2017
1 parent 34b1b2b commit 91ce39c
Show file tree
Hide file tree
Showing 64 changed files with 14,093 additions and 71 deletions.
61 changes: 59 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,74 @@
SimpleJSON is an improved version of [json-simple](https://github.com/fangyidong/json-simple).
It adds type safety, serialization, tidy formatting and improved performance.

# Why use this library over the original?

Because the original was made for Java 2. A version of Java where things like generics weren't there yet. That causes code written with the original library to be completly type unsafe.
It was a casting hell. And on top of that, you could not serialize and deserialize objects.

# Requirements

- Java 8 or higher

# Example
# Short Example

JSON:
```json
{
"first_name":"John",
"last_name":"Doe",
"income":1200.0,
"friends": [
{
"first_name":"Jane",
"last_name":"Doe",
"income":1000.0,
"friends" [
"John|Doe"
]
}
]
}
```

Java:
```java
try {

String myJSONData = "<Insert code from above>";
JSONObject object = new JSONObject(myJSONData);
String firstName = object.getString("first_name");
String friendsFirstName = object.getArray("friends").getObject(0).getString("first_name");
float income = object.getFloat("income");

} catch(JSONParseException exception) {

exception.printStackTrace();
}
```

# List of changes made to the original library

This list only applies to version 1.0.0 of this library!


- The packages of the original are merged into one
- All public classes now have `JSON` in front of their name. This makes it easier to tell which classes come from that library. Also clears a conflict with the `java.text.ParseException`.
- The `JSONParser` now uses actual stacks
- The `JSONParser` now uses `if-else` instead of `switch-case` because it is faster.
- Updated the documentation.
- Fixed a bug that made it impossible to parse valid JSON with white spaces leading and/or trailing.
- Made it possible to serialize and deserialize JSON
- Added the `JSONFormatter` class which makes it possible to format minimized or minimize formatted JSON data.
- Added more constructors to the `JSONArray` class
- Added constructors to the `JSONObject` and `JSONArray` class which allows direct and type safe parsing of JSON data.
- Added getter methods to `JSONObject` and `JSONArray` which allow type safe reading of data.
- Deleted all unneeded and deprecated methods.


# Links
See the [original](https://github.com/fangyidong/json-simple)
See the [online documentation](https://ralleytn.github.io/SimpleJSON/)
See the [changelog](https://github.com/RalleYTN/SimpleJSON/blob/master/CHANGELOG.md)
See the [download page](https://github.com/RalleYTN/SimpleJSON/releases)
See the [download page](https://github.com/RalleYTN/SimpleJSON/releases)
See the [complete guide](https://github.com/RalleYTN/SimpleJSON/wiki) on how to use the library
33 changes: 33 additions & 0 deletions docs/allclasses-frame.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="de">
<head>
<!-- Generated by javadoc (1.8.0_131) on Sun Jul 30 18:33:33 CEST 2017 -->
<title>All Classes</title>
<meta name="date" content="2017-07-30">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<h1 class="bar">All&nbsp;Classes</h1>
<div class="indexContainer">
<ul>
<li><a href="de/ralleytn/simple/json/JSONArray.html" title="class in de.ralleytn.simple.json" target="classFrame">JSONArray</a></li>
<li><a href="de/ralleytn/simple/json/JSONAttribute.html" title="annotation in de.ralleytn.simple.json" target="classFrame">JSONAttribute</a></li>
<li><a href="de/ralleytn/simple/json/JSONAttribute.Type.html" title="enum in de.ralleytn.simple.json" target="classFrame">JSONAttribute.Type</a></li>
<li><a href="de/ralleytn/simple/json/JSONAware.html" title="interface in de.ralleytn.simple.json" target="classFrame"><span class="interfaceName">JSONAware</span></a></li>
<li><a href="de/ralleytn/simple/json/JSONContainerFactory.html" title="interface in de.ralleytn.simple.json" target="classFrame"><span class="interfaceName">JSONContainerFactory</span></a></li>
<li><a href="de/ralleytn/simple/json/JSONContentHandler.html" title="interface in de.ralleytn.simple.json" target="classFrame"><span class="interfaceName">JSONContentHandler</span></a></li>
<li><a href="de/ralleytn/simple/json/JSONFormatter.html" title="class in de.ralleytn.simple.json" target="classFrame">JSONFormatter</a></li>
<li><a href="de/ralleytn/simple/json/JSONObject.html" title="class in de.ralleytn.simple.json" target="classFrame">JSONObject</a></li>
<li><a href="de/ralleytn/simple/json/JSONParseException.html" title="class in de.ralleytn.simple.json" target="classFrame">JSONParseException</a></li>
<li><a href="de/ralleytn/simple/json/JSONParser.html" title="class in de.ralleytn.simple.json" target="classFrame">JSONParser</a></li>
<li><a href="de/ralleytn/simple/json/JSONRoot.html" title="annotation in de.ralleytn.simple.json" target="classFrame">JSONRoot</a></li>
<li><a href="de/ralleytn/simple/json/JSONSerializer.html" title="class in de.ralleytn.simple.json" target="classFrame">JSONSerializer</a></li>
<li><a href="de/ralleytn/simple/json/JSONStreamAware.html" title="interface in de.ralleytn.simple.json" target="classFrame"><span class="interfaceName">JSONStreamAware</span></a></li>
<li><a href="de/ralleytn/simple/json/JSONTypeSerializationHandler.html" title="interface in de.ralleytn.simple.json" target="classFrame"><span class="interfaceName">JSONTypeSerializationHandler</span></a></li>
<li><a href="de/ralleytn/simple/json/JSONValue.html" title="class in de.ralleytn.simple.json" target="classFrame">JSONValue</a></li>
</ul>
</div>
</body>
</html>
33 changes: 33 additions & 0 deletions docs/allclasses-noframe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="de">
<head>
<!-- Generated by javadoc (1.8.0_131) on Sun Jul 30 18:33:33 CEST 2017 -->
<title>All Classes</title>
<meta name="date" content="2017-07-30">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<h1 class="bar">All&nbsp;Classes</h1>
<div class="indexContainer">
<ul>
<li><a href="de/ralleytn/simple/json/JSONArray.html" title="class in de.ralleytn.simple.json">JSONArray</a></li>
<li><a href="de/ralleytn/simple/json/JSONAttribute.html" title="annotation in de.ralleytn.simple.json">JSONAttribute</a></li>
<li><a href="de/ralleytn/simple/json/JSONAttribute.Type.html" title="enum in de.ralleytn.simple.json">JSONAttribute.Type</a></li>
<li><a href="de/ralleytn/simple/json/JSONAware.html" title="interface in de.ralleytn.simple.json"><span class="interfaceName">JSONAware</span></a></li>
<li><a href="de/ralleytn/simple/json/JSONContainerFactory.html" title="interface in de.ralleytn.simple.json"><span class="interfaceName">JSONContainerFactory</span></a></li>
<li><a href="de/ralleytn/simple/json/JSONContentHandler.html" title="interface in de.ralleytn.simple.json"><span class="interfaceName">JSONContentHandler</span></a></li>
<li><a href="de/ralleytn/simple/json/JSONFormatter.html" title="class in de.ralleytn.simple.json">JSONFormatter</a></li>
<li><a href="de/ralleytn/simple/json/JSONObject.html" title="class in de.ralleytn.simple.json">JSONObject</a></li>
<li><a href="de/ralleytn/simple/json/JSONParseException.html" title="class in de.ralleytn.simple.json">JSONParseException</a></li>
<li><a href="de/ralleytn/simple/json/JSONParser.html" title="class in de.ralleytn.simple.json">JSONParser</a></li>
<li><a href="de/ralleytn/simple/json/JSONRoot.html" title="annotation in de.ralleytn.simple.json">JSONRoot</a></li>
<li><a href="de/ralleytn/simple/json/JSONSerializer.html" title="class in de.ralleytn.simple.json">JSONSerializer</a></li>
<li><a href="de/ralleytn/simple/json/JSONStreamAware.html" title="interface in de.ralleytn.simple.json"><span class="interfaceName">JSONStreamAware</span></a></li>
<li><a href="de/ralleytn/simple/json/JSONTypeSerializationHandler.html" title="interface in de.ralleytn.simple.json"><span class="interfaceName">JSONTypeSerializationHandler</span></a></li>
<li><a href="de/ralleytn/simple/json/JSONValue.html" title="class in de.ralleytn.simple.json">JSONValue</a></li>
</ul>
</div>
</body>
</html>
165 changes: 165 additions & 0 deletions docs/constant-values.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="de">
<head>
<!-- Generated by javadoc (1.8.0_131) on Sun Jul 30 18:33:33 CEST 2017 -->
<title>Constant Field Values</title>
<meta name="date" content="2017-07-30">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Constant Field Values";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="de/ralleytn/simple/json/package-summary.html">Package</a></li>
<li>Class</li>
<li>Use</li>
<li><a href="de/ralleytn/simple/json/package-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-files/index-1.html">Index</a></li>
<li><a href="help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?constant-values.html" target="_top">Frames</a></li>
<li><a href="constant-values.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Constant Field Values" class="title">Constant Field Values</h1>
<h2 title="Contents">Contents</h2>
<ul>
<li><a href="#de.ralleytn">de.ralleytn.*</a></li>
</ul>
</div>
<div class="constantValuesContainer"><a name="de.ralleytn">
<!-- -->
</a>
<h2 title="de.ralleytn">de.ralleytn.*</h2>
<ul class="blockList">
<li class="blockList">
<table class="constantsSummary" border="0" cellpadding="3" cellspacing="0" summary="Constant Field Values table, listing constant fields, and values">
<caption><span>de.ralleytn.simple.json.<a href="de/ralleytn/simple/json/JSONParseException.html" title="class in de.ralleytn.simple.json">JSONParseException</a></span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th scope="col">Constant Field</th>
<th class="colLast" scope="col">Value</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a name="de.ralleytn.simple.json.JSONParseException.ERROR_UNEXPECTED_CHAR">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<td><code><a href="de/ralleytn/simple/json/JSONParseException.html#ERROR_UNEXPECTED_CHAR">ERROR_UNEXPECTED_CHAR</a></code></td>
<td class="colLast"><code>0</code></td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a name="de.ralleytn.simple.json.JSONParseException.ERROR_UNEXPECTED_EXCEPTION">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<td><code><a href="de/ralleytn/simple/json/JSONParseException.html#ERROR_UNEXPECTED_EXCEPTION">ERROR_UNEXPECTED_EXCEPTION</a></code></td>
<td class="colLast"><code>2</code></td>
</tr>
<tr class="altColor">
<td class="colFirst"><a name="de.ralleytn.simple.json.JSONParseException.ERROR_UNEXPECTED_TOKEN">
<!-- -->
</a><code>public&nbsp;static&nbsp;final&nbsp;int</code></td>
<td><code><a href="de/ralleytn/simple/json/JSONParseException.html#ERROR_UNEXPECTED_TOKEN">ERROR_UNEXPECTED_TOKEN</a></code></td>
<td class="colLast"><code>1</code></td>
</tr>
</tbody>
</table>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="de/ralleytn/simple/json/package-summary.html">Package</a></li>
<li>Class</li>
<li>Use</li>
<li><a href="de/ralleytn/simple/json/package-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-files/index-1.html">Index</a></li>
<li><a href="help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?constant-values.html" target="_top">Frames</a></li>
<li><a href="constant-values.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
Loading

0 comments on commit 91ce39c

Please sign in to comment.