I need to generate an url with an array parameter, or looking like so:
?array_name[]=value1&array_name[]=value2
How to achieve this with Uri.Builder
? The following code:
Uri.Builder builder = new Uri.Builder();
builder.appendQueryParameter("array[]", "one");
builder.appendQueryParameter("array[]", "another");
String result = builder.build().toString();
Gets me this output:
?array%5B%5D=one&array%5B%5D=another
In which square brackets are escaped.
How do I obtain the result that I want? I wouldn't like to ditch Uri.Builder
altogether as the solution is already based on that class.