gpt4 book ai didi

android - 如何为动态 key 解析此类 JSON 数据

转载 作者:行者123 更新时间:2023-11-29 02:07:22 25 4
gpt4 key购买 nike

{"Freedom Plan 4900":
{
"sale_price1":["$10.00","$20.00","$25.00","$50.00","$100.00"],
"loc_rate1":["India (2.0¢ per min)"],
"net_minutes1":["500","1,000","1,250","2,500","5,000"],
"loc_rate":["India - Mobile (1.5¢ per min)"],
"net_minutes":["666","1,333","1,666","3,433","6,866"]
},

"Super Offer Plan":
{
"sale_price1":["$10.00"],
"loc_rate1":["India (1.5¢ per min)"],
"net_minutes1":["667"],
"loc_rate":["India - Mobile (1.0¢ per min)"],
"net_minutes":["1,000"]
}

我想解析这个json字符串

最佳答案

我会使用类似 GSON 的东西:

http://sites.google.com/site/gson/gson-user-guide

创建类来保存数据(例如 PhonePlan 等)并让 GSON 解析 JSON 字符串。

PhonePlan plan = gson.fromJson(json, PhonePlan.class);

关于android - 如何为动态 key 解析此类 JSON 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9274191/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com