I am facing the issue in passing the JSON array in ion library. How can I send the send the two JSON arrays and the JSON objects in the ion library.
In the below code how can I pass the json array into the ion library.
JsonObject jsonObject = new JsonObject();
JsonArray keywordTags = new JsonArray();
for (String tagsKeyWord:tags) {
JsonPrimitive jsonPrimitive = new JsonPrimitive(tagsKeyWord);
keywordTags.add(jsonPrimitive);
}
jsonObject.add("tags",keywordTags);
Ion.with(this)
.load("http://database/api/scamer-database")
.setHeader("Authorization", authorization)
.setTimeout(60 * 60 * 1000);
.setMultipartParameter("city_subur",city)
.setMultipartParameter("state",state)
.setMultipartParameter("postalCode",postalCode)
.setMultipartParameter("tags", jsonObject.toString() )
.setMultipartParameter("tactics",tactic)
.withResponse()
.setCallback(new FutureCallback<Response<JsonObject>>() {
@Override
public void onCompleted(Exception e, Response<JsonObject> result) {
}
});
The output is like
{
"city_subur": "Homenickside",
"state": "Bartellside",
"postalCode": "46228-0535",
"tags": [
"tag name 1",
"tag name 2",
"Apply Online"
]
"tactic": [
"Called me",
"Asked My Mobile #",
"Asked my account number"
]
}
How can I add the tags fields in an ion library? Please help me how to solve this.