将json响应中的列表转换为逗号delimed

时间:2017-11-30 04:31:37

标签: json org.json

您好我将json响应对象转换为字符串

json对象:

{"docInformation":[{"docsWithinTheAlertingRegion":[2134,12521],"toatlNotifiedViaSms":0,"totalAccepted":1}]}

如何将docsWithinTheAlertingRegion":[2134,12521]转换为逗号分隔的文字docsWithinTheAlertingRegion":2134,12521

我想要的输出是json对象:

{"docInformation":[{"docsWithinTheAlertingRegion":2134,12521,"toatlNotifiedViaSms":0,"totalAccepted":1}]}

以下是我的代码片段

**BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
     String inputLine;
     StringBuffer response = new StringBuffer();
     while ((inputLine = in.readLine()) != null) {
    System.out.println("line number:"+ inputLine); 
        response.append(inputLine);
     }
     in.close();
    JSONObject jsonObj = new JSONObject(response.toString()); 
    String str = XML.toString(jsonObj);**

1 个答案:

答案 0 :(得分:0)

我不明白你的代码是做什么的 但是这个纯JS代码可以满足您的需求

df.loc[top:bottom, left:right]