I'm trying to put two int [] and a double [] in JSON format to send through my java servlet. This is what I have so far.
private JSONObject doStuff(double[] val, int[] col_idx, int[] row_ptr){
String a = JSONValue.toJSONString(val);
String b = JSONValue.toJSONString(col_idx);
String c = JSONValue.toJSONString(row_ptr);
JSONObject jo = new JSONObject();
jo.put("val",a)
jo.put("col",b);
jo.put("row",c);
return jo;
}
But when I print the JSONobject, I get this unreadable result:
{"val":"[D@62ce3190","col":"[I@4f18179d","row":"[I@36b66cfc"}
I get the same result in javascript where I am sending the JSONObject to. Is there a problem with the conversion from numbers to string? Should I perhaps use JSONArray instead?