So let's suppose I have a string like
"param1=value1¶m2={"url":"http://somesite.com?someparam=somevalue&someparam1=somevalue1"}¶m3=value3"
and I need it to be:
param1: value1
param2: {"url":"http://somesite.com?someparam=somevalue&someparam1=somevalue1"}
param3: value3
What would be the best approach to parse this in Java? So far I could not found a solution with standard Java libraries, and I don't want to reinvent the wheel.
I've tried with (but it would not work if I put there only query parameters like mine):
String url = "http://www.example.com/something.html?one=11111&two=22222&three=33333";
List<NameValuePair> params = URLEncodedUtils.parse(new URI(url), "UTF-8");
for (NameValuePair param : params) {
System.out.println(param.getName() + " : " + param.getValue());
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…