The first part of the basic dependency, the transformation between the data structure to explain.
Json-lib can convert the Beans,maps,collections,java arrays,xml to JSON and then convert the JSON to Beans,dynabeans.
The conversion relationship between Java,javascript and JSON
JSON |
|
Java |
String |
<=> |
Java.lang.String, Java.lang.Character, Char |
Number |
<=> |
Java.lang.Number, Byte, short, int, long, float, double |
True|false |
<=> |
Java.lang.Boolean, Boolean |
Null |
<=> |
Null |
function |
<=> |
Net.sf.json.JSONFunction |
Array |
<=> |
Net.sf.json.JSONArray (object, String, number, Boolean, function) |
Object |
<=> |
Net.sf.json.JSONObject |
There are two kinds of json-lib, one is json-lib-x.x-jdk12, need JDK 1.3.1 and above, one is json-lib-x.x-jdk15 need jdk15, and the above version.
Dependent Packages:
- Jakarta Commons-lang 2.5
- Jakarta commons-beanutils 1.8.0
- Jakarta commons-collections 3.2.1
- Jakarta commons-logging 1.1.1
- Ezmorph 1.0.6
These dependent packages, not less, such as Ezmorph, a disadvantage of this json-lib is more dependent, easy to lose. and dependent on the version number to the upper, Commons package some high version introduced incompatible, I introduced Lang3 and Beanutils 2 is not, so the version number to the upper.
I put some of my pro-test can be in the jar to share the Baidu network disk, click on the above dependent jar package is, but the version may not be exactly the same, but all can be used.
json-lib-jdk1.5 finally is Json-lib package, convenient for everyone to download, you can also go to the official website to download.
A brief introduction to the--json-lib of the Json experience (i.)