1

我用 PostgreSQL 在 Heroku 上设置了 ServiceStack(按照http://friism.com/running-net-on-heroku)。但是json返回格式错误,这里是json

344
[{"Id":3,"Code":"EUR","Name":"Đồng EUR","RecVersion":3,"RecId":3,"RecCreated":"2013-09-13T07:29:30.7228990","RecCreatedBy":1,"Status":"1","RecModified":"2013-09-13T07:29:30.7228990","RecModifiedBy":1},{"Id":4,"Code":"JPY","Name":"Đồng Yên Nhật","RecVersion":4,"RecId":4,"RecCreated":"2013-09-13T07:29:30.7275190","RecCreatedBy":1,"Status":"1","RecModified":"2013-09-13T07:29:30.7275190","RecModifiedBy":1},{"Id":2,"Code":"USD","Name":"Đồng Đôla Mỹ","RecVersion":2,"RecId":2,"RecCreated":"2013-09-13T07:29:30.7183870","RecCreatedBy":1,"Status":"1","RecModified":"2013-09-13T07:29:30.7183870","RecModifiedBy":1},{"Id":1,"Code":"VND","Name":"Đồng Việt Nam","RecVersion":1,"RecId":1,"RecCreated":"2013-09-13T07:29:30.7121270","RecCreatedBy":1,"Status":"1","RecModified":"2013-09-13T07:29:30.7121270","RecModifiedBy":1}]

0

它包括 344 和 0。

但如果我跟随

https://github.com/kunjee17/ServiceStackHeroku

json 返回没问题 ( http://thawing-shelf-3867.herokuapp.com/Rockstars?format=json )

如何修复它。非常感谢你

4

1 回答 1

1

json 不包含额外的数字 - 如果单击“查看 json 数据源”,您将看到预期的 json。所以,错误的不是 json 格式。

如果您查看响应(例如,使用 Chrome 开发工具的网络响应选项卡),您会看到额外的数字在 html 标记之外。在将 ServiceStack 响应传递给客户端之前,有些东西正在向它添加额外的字符。我会专注于您的配置设置。也许这与 Heroku 上的 nginx 中未正确设置字符编码有关?

在此处输入图像描述

于 2013-09-13T17:37:50.250 回答