Convert JSONArray to String in javascript to send in java

I am working with an Android application that uses telephone service. Java calls some HTML that displays a web page, and HTML uses javascript for functions. Now in javascript, I am making a JSON call using parameters from HTML. The problem is that I need to send this JSONArray back to the Java class. However, when I use

JavaActivity.parseJson(jsonArray.toString());

(where jsonArray is JSONArray and parseJson is a method in java activity)

the sent string looks something like this:

[{Object:Object}, {Object:Object}, {Object:Object}, .....]

What am I doing wrong or is there another way to convert this string or just send JSONArray directly?

+5
source share
1 answer

, jsonArray , Java, :

var jString = JSON.stringify(jsonArray);

'jString' json .

+12

All Articles