我想使用循环j发布一个字符串数组和对象对服务器的对象



每当我获得错误时" 糟糕的请求"。我正在尝试发布这样的数据JSON

{
"name":"testOne",
"location": "['one','two','three']"
}

这是我的代码

    AsyncHttpClient client = new AsyncHttpClient();
    String someData="{"name":"testOne","location": "['ne','two','three']"}";
    ByteArrayEntity be = new ByteArrayEntity(someData.toString().getBytes());
    client.post(MainActivity.this, "http://impero-dannyfast.rhcloud.com/api/agents", be, "application/json", new AsyncHttpResponseHandler() {
        @Override
        public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
            Toast.makeText(MainActivity.this, "Succ", Toast.LENGTH_SHORT).show();
        }
        @Override
        public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
            Toast.makeText(MainActivity.this, "fail"+statusCode, Toast.LENGTH_SHORT).show();
        }
        });

查看这些教程,您将获得答案https://www.youtube.com/watch?v=frltqnskqia&amp = flltqnskqia& amp; list=plgjt1h_kabfebfebfebun1angyz6_tfkw6_tfkw64w64wwwwwwwwwwwwwwwwww1 2 2 exexc.1111111111>

{
"name":"testOne",
"location": ["one","two","three"]
}

尝试像这样发送

相关内容

  • 没有找到相关文章

最新更新