在谷歌应用引擎 (java) 上解析 JSON
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10087256/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Parsing JSON on google app engine (java)
提问by user1049280
i use org.jsonlibrary to work with JSON-data in my apps. But it seems that google app engine doesn't allow to use it, what's the best way to work with JSON on GAE-apps?
我使用org.json库在我的应用程序中处理 JSON 数据。但似乎谷歌应用引擎不允许使用它,在 GAE 应用程序上使用 JSON 的最佳方式是什么?
回答by husayt
I had the similar question a week ago and after comparing a number of Java JSON libraries (including JSonLIB and GSON) I have chosen Hymanson. Check other comparisons on StackOverflow, most of them would recommend Hymanson out of the rest.
一周前我遇到了类似的问题,在比较了许多 Java JSON 库(包括 JsonLIB 和 GSON)之后,我选择了Hymanson。检查 StackOverflow 上的其他比较,他们中的大多数人会推荐Hyman逊。
After two weeks using it on Google Appengine, I just love it. Not only it has more features than the other mentioned libraries, it is also much faster (see benchmarks here). It is a Json engine in Jerseywhich I would recommend as well if you want to do anything Restful on Appengine.
在 Google Appengine 上使用它两周后,我很喜欢它。它不仅具有比其他提到的库更多的功能,而且速度也更快(请参阅此处的基准测试)。它是泽西岛的一个 Json 引擎,如果你想在 Appengine 上做任何 Restful,我也会推荐它。
It is stable and still actively developed, with version 2 has just been released couple of weeks ago.
它很稳定并且仍在积极开发中,几周前刚刚发布了第 2 版。
UPDATE: hereis a sample demo for using Hymanson with GAE.
更新:这是将 Hymanson 与 GAE 一起使用的示例演示。
回答by Nagaraju Badaeni
回答by Daniel De León
Use fast JSON is a very productive API. Hymanson take too much code.
使用快速 JSON 是一个非常高效的 API。Hyman逊需要太多的代码。
http://code.alibabatech.com/wiki/display/FastJSON/Home
http://code.alibabatech.com/wiki/display/FastJSON/Home
https://github.com/alibaba/fastjson
https://github.com/alibaba/fastjson
Just copy the library into WEB-INF/lib folder and use the static methods of com.alibaba.fastjson.JSON
like JSON.toJSONString(object)
只需将库复制到 WEB-INF/lib 文件夹中并使用com.alibaba.fastjson.JSON
类似的静态方法JSON.toJSONString(object)