@@ -43,14 +43,12 @@ public static String parse(final String name, final JSONObject request) {
4343 if (set != null ) {
4444
4545 Object value ;
46- String pairKey ;
4746 for (String key : set ) {
4847 value = request .get (key );
4948 if (value == null ) {
5049 continue ;
5150 }
5251
53- pairKey = new String (key instanceof String ? "\" " + key + "\" " : key );
5452 if (value instanceof JSONObject ) {//APIJSON Array转为常规JSONArray
5553 if (isArrayKey (key )) {//APIJSON Array转为常规JSONArray
5654 response += NEWLINE + NEWLINE + "//" + key + "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" ;
@@ -65,22 +63,25 @@ public static String parse(final String name, final JSONObject request) {
6563
6664 String prefix = key .substring (0 , key .length () - 2 );
6765 response += NEWLINE + NEWLINE
68- + parentKey + ".add (" + getItemKey (key ) + ".toArray("
66+ + parentKey + ".putAll (" + getItemKey (key ) + ".toArray("
6967 + count + ", " + page + (prefix .isEmpty () ? "" : ", \" " + prefix + "\" " ) + "));" ;
7068
7169 response += NEWLINE + "//" + key + ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + NEWLINE ;
72- } else {//常规JSONObject,往下一级提取
70+ }
71+ else {//常规JSONObject,往下一级提取
7372 response += NEWLINE + NEWLINE + "//" + key + "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" ;
7473
7574 response += parse (key , (JSONObject ) value );
7675
77- response += NEWLINE + NEWLINE + parentKey + ".put(" + pairKey + ", " + getTableKey (key ) + ");" ;
76+ response += NEWLINE + NEWLINE + parentKey + ".put(\" " + key + " \ " , " + getTableKey (key ) + ");" ;
7877 response += NEWLINE + "//" + key + ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + NEWLINE ;
7978 }
80- } else {//其它Object,直接填充
79+ }
80+ else {//其它Object,直接填充
8181 if (value instanceof String ) {
8282 value = "\" " + value + "\" " ;
83- } else if (value instanceof JSONArray ) {
83+ }
84+ else if (value instanceof JSONArray ) {
8485 String s = StringUtil .getString (value );
8586 if (s .startsWith ("[" )) {
8687 s = s .substring (1 );
@@ -93,7 +94,7 @@ public static String parse(final String name, final JSONObject request) {
9394 value = "new Object[]{" + s + "}" ;//反射获取泛型太麻烦,反正开发中还要改的
9495 }
9596
96- response += NEWLINE + parentKey + ".put(" + pairKey + ", " + value + ");" ;
97+ response += NEWLINE + parentKey + ".put(\" " + key + " \ " , " + value + ");" ;
9798 }
9899 }
99100 }
0 commit comments