这是我的JSON值,如何获取JSON值给变量?
{"test":"ruslan","status":"OK"}
如何获得 “测试” 的价值?
这是我HttpClient的代码存取权限的API
AsyncHttpClient client = new AsyncHttpClient();
client.setBasicAuth("user01", "pwd01");
client.get("http://localhost/web/api/getsession", new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
// in this section, I want to store test value from json to a variable
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
Log.d("Status", "failure");
}
});
1)通过'http://本地主机/网络/'是行不通2)如果是JSON字符串你的应用?你似乎需要首先将一个byte []转换为一个字符串。 –