JSON,无法使用key显示所需信息!

发布于 2024-10-24 08:07:19 字数 763 浏览 1 评论 0原文

我正在使用 android 1.5,目前正在研究 JSON 相关的东西。我在字符串变量str中拥有此信息

{
"UserInfo":
    [
    {"LastName":"b","FirstName":"a","Gender":"Male","User: ":1},
    {"LastName":"b","FirstName":"a","Gender":"Male","User: ":2},
    {"LastName":"b","FirstName":"a","Gender":"Male","User: ":3}
    ]
}
{
"Info":
    [
    {"LastName":"d","FirstName":"c","Gender":"Male","User: ":5},
    {"LastName":"d","FirstName":"c","Gender":"Male","User: ":6},
    {"LastName":"d","FirstName":"c","Gender":"Male","User: ":7},
    {"LastName":"d","FirstName":"c","Gender":"Male","User: ":8},
    {"LastName":"d","FirstName":"c","Gender":"Male","User: ":9},
    ]
}

,我在str中拥有所有这些信息,现在通过使用键(即UserInfo和Info)我想使用信息来显示其所有元素。我该怎么做? 谢谢!

im using android 1.5 and currently working on JSON related stuff. i have this info in a String variable str

{
"UserInfo":
    [
    {"LastName":"b","FirstName":"a","Gender":"Male","User: ":1},
    {"LastName":"b","FirstName":"a","Gender":"Male","User: ":2},
    {"LastName":"b","FirstName":"a","Gender":"Male","User: ":3}
    ]
}
{
"Info":
    [
    {"LastName":"d","FirstName":"c","Gender":"Male","User: ":5},
    {"LastName":"d","FirstName":"c","Gender":"Male","User: ":6},
    {"LastName":"d","FirstName":"c","Gender":"Male","User: ":7},
    {"LastName":"d","FirstName":"c","Gender":"Male","User: ":8},
    {"LastName":"d","FirstName":"c","Gender":"Male","User: ":9},
    ]
}

i have all this info in str, now by using key (i.e. UserInfo and Info) i wana use info to display all its elements. how can i do that??
thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文