简体   繁体   中英

json format as parameter for cordova or phonegap ios plugin

I'm creating a phonegap plugin for ios my question is instead of the usual "string" parameter can i pass a json format parameter?

Every tutorials i've found uses string as a parameter. How would i do it if i will use a json format variable as parameter to my plugin? thank you.

If you prepare the JSON-Data, before passing it to Cordova.exec use JSON.stringify

PhoneGap.exec('Alarm.update',JSON.stringify(list));

Maybe this could help you: PhoneGap exec passing JSON

在当前版本中,可以读取通过Javascript传递的对象:

JSONObject params = args.getJSONObject(0);

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM