开发者

Is it possible to parse with JSON file using org.json in Java?

How could be parse it for example?

{
    "392bc124":        {
            "ts":        {
                    "value":        "File content"
            },
            "type":        "File content",
            "sn":        "File content"
    },
    "07dba83e":        {
            "ts":        {
                    "value":        "File content"
            },
            "type":        "File content",
            "sn":        "File content"
    },
    "a24faa33":        {
            "ts":        {
                    "value":        "File content"
            },
            "type":        "File content",
            "sn":        "File content"
    }
}

I know how it to works only for with one

{
    "devices" : [
        {
            "name"  : "07dba83e"
            "sn"    : "c8abddf44e49986ff2cd03be6fd2b1fc",
            "type"  : "output",
            "value" : "100"
        },
        {
            "name"  : "392bc124"
            "sn"    : "644f2821b26a7d6c93720b26c5044b40",
            "type"  : "input",
            "value" : "12"
        },
        {
            "name"  : "a24faa33"
            "sn"    : "2893a640fd1b6102c84f035c42ee4257",
            "type"  : "dimmer",
            "value" : "0"
        }
    ]
}

how could i get "392bc124" json object if i don't know the name ("392bc124")? On the second sample i have an array and it ok, but i don't know, are there any ways to parse the fir开发者_如何学JAVAst one?


Presumably, you would use getNames or keys

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜