我的回复是有效的JSON吗?

时间:2013-02-11 15:14:03

标签: symfony json

我正在尝试从我的数据库中获取数据并将其转换为JSON(Symfony2) 以下是我访问json页面时收到的回复:

HTTP/1.0 200 OK Cache-Control: no-cache Content-Type: application/json Date: Mon, 11 Feb 2013 15:05:03 GMT "[{\"id\":1,\"iam\":1,\"youare\":2,\"lat\":50.8275853,\"lng\":4.3809764,\"msgbody\":\"I saw you over there what's up!\"},{\"id\":2,\"iam\":1,\"youare\":2,\"lat\":50.8275853,\"lng\":4.3809764,\"msgbody\":\"I saw you over there what's up!\"},{\"id\":3,\"iam\":1,\"youare\":2,\"lat\":50.8275853,\"lng\":4.3809764,\"msgbody\":\"I saw you over there what's up!\"},{\"id\":4,\"iam\":1,\"youare\":2,\"lat\":50.8275853,\"lng\":4.3809764,\"msgbody\":\"I saw you over there what's up!\"},{\"id\":5,\"iam\":1,\"youare\":2,\"lat\":50.8275853,\"lng\":4.3809764,\"msgbody\":\"I saw you over there what's up!\"},{\"id\":6,\"iam\":1,\"youare\":2,\"lat\":50.8275853,\"lng\":4.3809764,\"msgbody\":\"I saw you over there what's up!\"}]"
  1. 我应该看到实际的标题吗?
  2. 双引号是否正常转义是否正常?
  3. 整件事应该是档案吗? foo.json?
  4. 您知道如何将Doctrine Entity正确转换为JSON吗?

2 个答案:

答案 0 :(得分:2)

您可以查看此链接: http://jsonviewer.stack.hu/ 它会让你清楚地知道你哪里出错了。

答案 1 :(得分:0)

您必须为浏览器下载json附加组件。 喜欢我使用chrome json附加组件 https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc?hl=en