没有任何数据可供显示
| 开源项目社区 | 当前位置 : |
|
| www.trustie.net/open_source_projects | 主页 > 开源项目社区 > jjson |
|
jjson
|
| 1 | 0 | 81 |
| 贡献者 | 讨论 | 代码提交 |
SummaryJJSon is a simple API for dealing with the JSON format. It needs no dependencies and just offers the features you really need to work. You can find the JSON Specification there: http://www.json.org
Currently JJSON does not need any dependency - it's planned that it will not need any dependencies in the future. Standalone is the king ;-)
FeaturesCreating a java object net out of a json string Creating a json string out of a java object net Why another JSon-Lib for Java?I just didn't want to have complex implementations of this simple notation- most of the features other libs gave to me i didn't use. They just stole my performance :-)
However, my implementation lacks a lot of features i want have right now, but hey, it's alpha, it's fun and maybe in some time i will have exactly the lib i wanted- may it fit for you too.
State of developmentJJSon is very simple and straightforward right now. If you download this jar-File, you get Classes which represent the current supported JSON-Types. These Objects can easily transformed into a JSON-String and vice versa.
Version 0.0.3 is out. It's a bugfix release.
Version 0.1.0 will have a JSONAnnotationDecoder and a JSONAnnotationEncoder, which creates a JSON-String from a java object and vice versa. The JSONAnnotationEncoder is allready available in the trunk.
InstallJust drop the jar-File into your projects classpath and go for it. Cause of the early state of development there is no Maven-Distribution available at the moment.
UsageYou can do such stuff:
JSONObject o = new JSONObject();
o.put("mykey", new JSONString("myvalue"));To transform this object into a JSON-String, just type:
object.toJSON()This will result in:
{"mykey":"myvalue"}On the other hand the new decoder creates a object net out of a json string:
JSONDecoder decoder = new JSONDecoder("{\"key\":\"value\",\"key2\":{\"key3\":\"value2\"}}");
JSONValue result = decoder.decode();
TestCase.assertEquals(
"{\"key2\":{\"key3\":\"value2\"},\"key\":\"value\"}",
result.toJSON());
标签:
