In Mobilefirst Platform 8.0, in order to send a request to an adapter procedure I can use something like this
resourceRequest.setQueryParameter("params", "['Washington', 'United States']");
But this is for 2 string values. How can I send a JSON object instead of a string?
I would like to send something like this:
var request = {name: 'George', suername: 'Williams', Id: '1234'};
resourceRequest.setQueryParameter("params", request);
If yes, what is the correct syntax?
Try the following approaches:
Pass it directly, but as a string...
resourceRequest.setQueryParameter("params", “[{'name' : 'bob', ''age' : 25}, 'United States']");
Create a JSONArray and pass it
JSONArray params = new JSONArray(); params.putObject(myJsonObject); resourceRequest.setQueryParameter("params", params);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.