本文介绍了如何解析此queryString,这是JSON响应的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经解析了一个JSON响应,并在下面得到了String:

I have parsed a JSON response and got the String below :

String queryString = "AQB=1&v1=somev1data&v25=somev25data&URL=http://www.someurl.com/configure/getvalues/request1=req1Passed&data2=somedataPassed&ce=UTF-8&ARB=1";

当我分割上面的queryString时,输出应为:

When i split the above queryString the output should be :

AQB=1
v1=somev1data
v25=somev25data
URL=http://www.someurl.com/configure/getvalues/request1=req1Passed&data2=somedataPassed
ce=UTF-8
ARB=1

注意:
queryString始终更改,URL参数也始终更改.AQB,v1 ..... v30,p1 .... p30,ce,pre,pe,URL,ARB都是预定义的变量名.

NOTE :
queryString always changes and the URL parameters also always changes.AQB,v1.....v30,p1....p30,ce,pre,pe,URL,ARB are all the predefined variable names.

推荐答案

除非URL参数经过正确的URL编码,否则不可能.因此,&"字符将被转义,以免被解释为字段分隔符.

It is NOT possible unless the URL parameter is properly URL-encoded, so the "&" characters will be escaped in order not to be interpreted as field separators.

字符串应像这样编码:

String queryString = "AQB=1&v1=somev1data&v25=somev25data&URL=http%3A%2F%2Fwww.someurl.com%2Fconfigure%2Fgetvalues%2Frequest1%3Dreq1Passed%26data2%3DsomedataPassed&ce=UTF-8&ARB=1";

因为它是在您的问题中格式化的格式,所以无法连续分析该字符串.

As it is formatted in your question, the string cannot be parsed successively.

这篇关于如何解析此queryString,这是JSON响应的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 00:27