我试图操纵一个 JsonArray 看起来像另一个 JsonArray。我对现有的 JsonArray 实现了一些字符串方法。现在我想把它放回另一个 JsonArray。
代码
Log.d("defaultArrayShuffled", defaultArray.toString());
String temp = defaultArray.toString();
String temp1= temp.replaceAll("_white_", "_");
Log.d("temp1", temp1);
JSONObject temp2 = new JSONObject();
temp2.put("arr", temp1);
Log.d("temp2", temp2.toString());
replacingArray = temp2.getJSONArray("arr");
LogCAT
07-03 19:16:37.310: D/defaultArrayShuffled(8863): ["findhidden\/o_white_64.png","findhidden\/x_white_64.png","findhidden\/f_white_64.png","findhidden\/b_white_64.png","findhidden\/a_white_64.png","findhidden\/g_white_64.png","findhidden\/p_white_64.png","findhidden\/u_white_64.png","findhidden\/n_white_64.png","findhidden\/j_white_64.png","findhidden\/y_white_64.png","findhidden\/q_white_64.png","findhidden\/l_white_64.png","findhidden\/t_white_64.png","findhidden\/h_white_64.png","findhidden\/v_white_64.png","findhidden\/r_white_64.png","findhidden\/k_white_64.png","findhidden\/m_white_64.png","findhidden\/c_white_64.png","findhidden\/z_white_64.png","findhidden\/s_white_64.png","findhidden\/w_white_64.png","findhidden\/d_white_64.png","findhidden\/i_white_64.png","findhidden\/e_white_64.png"]
07-03 19:16:37.310: D/temp1(8863): ["findhidden\/o_64.png","findhidden\/x_64.png","findhidden\/f_64.png","findhidden\/b_64.png","findhidden\/a_64.png","findhidden\/g_64.png","findhidden\/p_64.png","findhidden\/u_64.png","findhidden\/n_64.png","findhidden\/j_64.png","findhidden\/y_64.png","findhidden\/q_64.png","findhidden\/l_64.png","findhidden\/t_64.png","findhidden\/h_64.png","findhidden\/v_64.png","findhidden\/r_64.png","findhidden\/k_64.png","findhidden\/m_64.png","findhidden\/c_64.png","findhidden\/z_64.png","findhidden\/s_64.png","findhidden\/w_64.png","findhidden\/d_64.png","findhidden\/i_64.png","findhidden\/e_64.png"]
07-03 19:16:37.310: D/temp2(8863): {"arr":"[\"findhidden\\\/o_64.png\",\"findhidden\\\/x_64.png\",\"findhidden\\\/f_64.png\",\"findhidden\\\/b_64.png\",\"findhidden\\\/a_64.png\",\"findhidden\\\/g_64.png\",\"findhidden\\\/p_64.png\",\"findhidden\\\/u_64.png\",\"findhidden\\\/n_64.png\",\"findhidden\\\/j_64.png\",\"findhidden\\\/y_64.png\",\"findhidden\\\/q_64.png\",\"findhidden\\\/l_64.png\",\"findhidden\\\/t_64.png\",\"findhidden\\\/h_64.png\",\"findhidden\\\/v_64.png\",\"findhidden\\\/r_64.png\",\"findhidden\\\/k_64.png\",\"findhidden\\\/m_64.png\",\"findhidden\\\/c_64.png\",\"findhidden\\\/z_64.png\",\"findhidden\\\/s_64.png\",\"findhidden\\\/w_64.png\",\"findhidden\\\/d_64.png\",\"findhidden\\\/i_64.png\",\"findhidden\\\/e_64.png\"]"}
更多
07-03 19:16:37.320: W/System.err(8863): at org.json.JSON.typeMismatch(JSON.java:96)