Ryan Temple Ryan Temple - 1 year ago 146
Java Question

onJsAlert return message is object not string

I'm making a call

webView.setUpWebChromeClient( new WebChromeClient() {

public boolan onJsAlert(WebView view, String url, final String message, JsResult result) {

The message im getting is coming back as

[object Object];

It's supposed to be a JSON object thats the response however I can only get the String representation of the object. Please help on how I would access the object!

Answer Source

It's probably a json object but you are viewing it as a String. So you will need to translate the object to a String representation using JSON.stringify if you want to view it:


Instead of

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download