I'm new to java and android programming and I want to convert string array to json. Here's the format:
String[][] filters = new String[2][5];
for(int i=0; i<5; i++){
filters[0][i] = "text";
}
for(int i=0; i<5; i++){
filters[1][i] = "text";
}
I tried
JSONArray mJSONArray = new JSONArray(Arrays.asList(filters));
session.editor.putString("filters",mJSONArray.toString());
session.editor.commit();
then I checked it by printing it out like this
System.out.println(session.pref.getString("filters", null);)
but the output is like this
["[Ljava.lang.String;@41b91028","[Ljava.lang.String;@41b910a8"]
The reason why I want to convert it to json is because I want to pass it to a SharedPreferences, which requires a string to be passed. Also, I would also like to know how to decode it. Thanks.