如何将一个数组 赋值到另一个数组里?

java里如何得到这样子的{"A":"C","B":[{"p1":"p2"}]} 结果
String[] a={"A","B"};
String[] b={"C","D"};
String c="p1";
String d="p2";
求哪位大侠给出个详细点代码

只要能得到最后json里面的格式是json.tostring ={"A":"C","B":[{"p1":"p2"}]}这样的,就可以,参考参考 小弟不胜感激!

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**

  • @author WILLKINSON
  • @since 0.1 2016-6-30 */ public class Tester { public static void main(String[] args) { try { JSONObject json = new JSONObject(); json.put("A", "C"); List list = new ArrayList<>(); list.add("E"); list.add("F"); JSONArray innerJson = new JSONArray(list); json.put("B", innerJson); System.out.println(json.toString()); } catch (JSONException e) { e.printStackTrace(); } }

}

要用二维数组了
String[][]b=new String[2][];
b[0]={"C"};
b[1]={"E","F"};