Java 在文本视图中显示JSONStringer结果

Java 在文本视图中显示JSONStringer结果,java,android,json,string,Java,Android,Json,String,您好,我是webservices和json新手,因此我请求您帮助如何在textView中显示JSONString结果 这是我正在编写的代码: // Build JSON string JSONStringer TestApp = new JSONStringer().object().key("id") .value("1").key("name").value("manish").key("email"

您好,我是webservices和json新手,因此我请求您帮助如何在textView中显示JSONString结果

这是我正在编写的代码:

           // Build JSON string
           JSONStringer TestApp = new JSONStringer().object().key("id")
                        .value("1").key("name").value("manish").key("email")
                        .value("androidhub4you@gmail.com").key("country")
                        .value("india").endObject();
           String entity = new StringEntity(TestApp.toString());
           String var = entity.toString();
                TextView tv  = (TextView) findViewById (R.id.tvText);
        tv.setText(var);
显示:

           // Build JSON string
           JSONStringer TestApp = new JSONStringer().object().key("id")
                        .value("1").key("name").value("manish").key("email")
                        .value("androidhub4you@gmail.com").key("country")
                        .value("india").endObject();
           String entity = new StringEntity(TestApp.toString());
           String var = entity.toString();
                TextView tv  = (TextView) findViewById (R.id.tvText);
        tv.setText(var);
问题是它只是印刷品

   org.apache.http.entity StringEntity....
。我非常感谢你的帮助。提前感谢。

更改

String var = entity.toString();


StringEntity.toString()
返回对象的地址

谢谢,但是只显示不包括{}大括号的数据怎么样?@neknekmouh为什么要在textview中显示它?@neknekmouh必须解析json。你能更具体地说一下你需要什么吗?我将开始另一个线程。。谢谢这是链接: