只需使用
JSONObject.toString();
方法。看看OkHttp的教程:
public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");OkHttpClient client = new OkHttpClient();String post(String url, String json) throws IOException { RequestBody body = RequestBody.create(json, JSON); // new // RequestBody body = RequestBody.create(JSON, json); // old Request request = new Request.Builder() .url(url) .post(body) .build(); Response response = client.newCall(request).execute(); return response.body().string();}


