Json解析下面的给定响应

时间:2012-10-18 06:12:42

标签: java android json parsing

嗨我想解析下面的json回复

{
    "appstore_information": {
        "time_fence": {
            "auto_expire_app_restriction": {
                "enable_auto_expiry": true,
                "expiry_date": "10\/15\/2012 12:00:00 AM",
                "time_bound_access_restriction": {
                    "duration_in_hrs": 18,
                    "start_time": "10\/17\/2012 12:00:00 AM",
                    "time_zone": "(UTC+02:00) Cairo"
                }
            },
            "local_data_time_fence": {
                "enable_local_data_time_fence": true,
                "expire_time_limit": {
                    "days": 2,
                    "hours": 17,
                    "minutes": 16
                }
            }
        },
        "use_offline_access": true
    },
    "display_message": "Profile is available in information.",
    "message_status": "Success."
}

任何帮助将不胜感激

2 个答案:

答案 0 :(得分:2)

http://json.org/开始,这里是解析器库列表:

ASP:
    JSON for ASP.
    JSON ASP utility class.
ActionScript:
    ActionScript3.
    JSONConnector.
Ada:
    GNATCOLL.JSON.
Bash:
    Jshon.
    JSON.sh.
BlitzMax:
    bmx-rjson.
C:
    JSON_checker.
    YAJL.
    js0n.
    LibU.
    json-c.
    json-parser.
    jsonsl.
    WJElement.
    M's JSON parser.
    cJSON.
    Jansson.
    jsmn.
    cson.
C++:
    JSONKit.
    jsonme--.
    ThorsSerializer.
    JsonBox.
    jsoncpp.
    zoolib.
    JOST.
    CAJUN.
    libjson.
    nosjob.
    rapidjson.
C#:
    fastJSON.
    JSON_checker.
    Jayrock.
    Json.NET - LINQ to JSON.
    LitJSON.
    JSON for .NET.
    JsonFx.
    JSON@CodeTitans
    How do I write my own parser?
    JSONSharp.
    JsonExSerializer.
    fluent-json
    Manatee Json
Clojure:
    clojure-json.
    API for json.
Cobol:
    XML Thunder.
ColdFusion:
    ColdFusion 8.
    toJSON.
D:
    Cashew.
    Libdjson.
Dart:
    json library.
Delphi:
    Delphi Web Utils.
    JSON Delphi Library.
    JSON Toolkit.
    tiny-json.

E:
    JSON in TermL.
Erlang:
    ejson.
    mochijson2.
Fantom:
    Json.
Go:
    package json.
Haskell:
    RJson package.
    json package.
Haxe:
    hxJSON.
Java:
    org.json.
    org.json.me.
    Jackson JSON Processor.
    Json-lib.
    JSON Tools.
    Stringtree.
    SOJO.
    Jettison.
    json-taglib.
    XStream.
    Flexjson.
    JON tools.
    Argo.
    jsonij.
    fastjson.
    mjson.
    jjson.
    json-simple.
    json-io.
    JsonMarshaller.
    google-gson.
    Json-smart.
    FOSS Nova JSON.
JavaScript:
    JSON.
    json2.js.
    json_sans_eval.
    clarinet.
Lisp:
    Common Lisp JSON.
    Yason.
    Emacs Lisp.
LotusScript:
    JSON LS.
Lua:
    Json4Lua.
    LuaJSON.
    LuaJSON C Library.
    Lua CJSON.
    dkjson.
Matlab:
    JSONlab.
    JSON Parser.
    (another) JSON Parser.
Objective C:
    json-framework.
    MTJSON.
    JSONKit.
    yajl-objc.
    TouchJSON.
OCaml:
    Yojson.
    jsonm.
OpenLaszlo:
    JSON.

Perl:
    CPAN.
    perl-JSON-SL.
PHP:
    PHP 5.2.
    json.
    Services_JSON.
    Zend_JSON.
    Solar_Json.
    Comparison of php json libraries.
Pike:
    Public.Parser.JSON.
    Public.Parser.JSON2.
PL/SQL:
    pljson:
    Librairie-JSON.
PowerShell:
    PowerShell.
Prolog:
    SWI-Prolog HTTP support
    Ciao JSON encoder and decoder
Puredata:
    PuRestJson
Python:
    The Python Standard Library.
    simplejson.
    pyson.
    Yajl-Py.
    ultrajson.
Qt:
    QJson.
R:
    rjson.
Racket:
    json-parsing.
Rebol:
    json.r.
RPG:
    JSON Utilities.
Ruby:
    json.
    yajl-ruby.
    json-stream.
Scala:
    package json.
Scheme:
    MZScheme.
    PLT Scheme.
Squeak:
    Squeak.
Symbian:
    s60-json-library.
Tcl:
    JSON.
Visual Basic:
    VB-JSON.
    PW.JSON.
Visual FoxPro:
    fwJSON.
    JSON.
    vfpjson.

答案 1 :(得分:0)

您可以在Android上使用GSON,您可以创建POJOs镜像您的json数据结构,然后调用:

AppStoreInformation asi = new Gson().fromJson(jsonString, AppStoreInformation.class);

这是一篇可能有用的文章:Android Series: Parsing JSON data with GSON