java 获取json 里面的嵌套变量?
有一个json是这样的:{"errInfo":{"no":"0"},"data":{"rememberedUserName":"","codeString":"captc...
有一个json是这样的:
{"errInfo":{ "no": "0" }, "data": { "rememberedUserName" : "", "codeString" : "captchaservice356162634f75575a424c74446a7965393077694d51426f43474a687a56355264362f376a575154446e43587373506f64472f4d646851467a684a566d46727937416a6b34484e6a577a43414c4455536b434d50686c5343775050472b6c57583936516a6a4f70627a5454734a647270687568414d32594f6f6959494542754f75474f35356c573337554555772b72427448664731762b6f70766e4768694563666769636d6e426f564a4a636b4d4c3969357471546c3052516c41334f6c6c4f666c45496d4d4e517432365348623256753263354f54766757346354364f74376f36594a347230554a634e6f6d386a7538354573685738622f364466386d796766576d7a782f654447757144467a6d646a4f4c5149703178534b793433742f3446463775744867", "token" : "the fisrt two args should be string type:0,1!", "cookie" : "0", "usernametype":"", "spLogin" : "rate", "disable":"", "loginrecord":{ 'email':[ ], 'phone':[ ] } }})
我怎么能获取codeString里面的内容??
除了用最原始那种一个一个换下推的方法,还有其它技巧或者方法吗? 展开
{"errInfo":{ "no": "0" }, "data": { "rememberedUserName" : "", "codeString" : "captchaservice356162634f75575a424c74446a7965393077694d51426f43474a687a56355264362f376a575154446e43587373506f64472f4d646851467a684a566d46727937416a6b34484e6a577a43414c4455536b434d50686c5343775050472b6c57583936516a6a4f70627a5454734a647270687568414d32594f6f6959494542754f75474f35356c573337554555772b72427448664731762b6f70766e4768694563666769636d6e426f564a4a636b4d4c3969357471546c3052516c41334f6c6c4f666c45496d4d4e517432365348623256753263354f54766757346354364f74376f36594a347230554a634e6f6d386a7538354573685738622f364466386d796766576d7a782f654447757144467a6d646a4f4c5149703178534b793433742f3446463775744867", "token" : "the fisrt two args should be string type:0,1!", "cookie" : "0", "usernametype":"", "spLogin" : "rate", "disable":"", "loginrecord":{ 'email':[ ], 'phone':[ ] } }})
我怎么能获取codeString里面的内容??
除了用最原始那种一个一个换下推的方法,还有其它技巧或者方法吗? 展开
2个回答
推荐于2016-09-19
展开全部
JSONObject dataJson=new JSONObject("你的Json数据“);
JSONObject data=dataJson.getJSONObject("data");
String codeString=data.getJSONObject("codeString");
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询