我想将 Json 字符串转换为数组这是我当前的代码
String[] comments = json2.getString(KEY_COMMENT);
KEY_COMMENT 是一个包含多个评论的字符串。评论被收集在一个 php 数组中,然后以 Json 字符串的形式发送回手机。如何将字符串转换为数组?
评论的一个例子是这样的
07-08 20:33:08.227: E/JSON(22615): {
"tag":"collectComments",
"success":1,
"error":0,
"numberOfComments":16,
"offsetNumber":1,
"comment":["test 16",
"test 15",
"test 14",
"test 13",
"test 12",
"test 11",
"test 10",
"test 9",
"test 8",
"test 7",
"test 6",
"test 5",
"test 4",
"test 3",
"test 2",
"test 1"]}n