{"files": {"Chrysanthemum.jpg": "Chrysanthemum.jpg", "index.html": "index.html", "1234.rmvb": "1234.rmvb", "apache_pb22_ani.gif": "apache_pb22_ani.gif", "123.mp4": "123.mp4", "sample_h264_1mbit.mp4": "sample_h264_1mbit.mp4", "1234.mp4": "1234.mp4", "apache_pb22.gif": "apache_pb22.gif", "test.doc": "test.doc", "apache_pb.gif": "apache_pb.gif", "testppt.pptx": "testppt.pptx", "love.mp3": "love.mp3", "apache_pb.png": "apache_pb.png", "sample_100kbit.mov": "sample_100kbit.mov", "apache_pb22.png": "apache_pb22.png", "receivetest.log": "receivetest.log", "111.docx": "111.docx", "test.txt": "test.txt"}, "dirs": {"receive": "receive", "test file": "test file"}}
假设这段数据,获取其中的files,不是value,是key
假设这段数据,获取其中的files,不是value,是key
string = string.replace("}", "");
string = string.replace("{", "");
string = string.replace("\"", "");
String[] strings = string.split(",");
if (type.equals("key")) {
String[] strings0 = new String[strings.length];
for (int i = 0; i < strings.length; i++) {
strings0[i] = strings[i].split(":")[0];
}
return strings0;
} else if (type.equals("value")) {
String[] strings1 = new String[strings.length];
for (int i = 0; i < strings.length; i++) {
strings1[i] = strings[i].split(":")[1];
}
return strings1;
} else {
return null;
}
}