是什么使此JSON无效?

时间:2018-07-31 14:44:00

标签: json

我们有一个API,它返回以下JSON输出,但是我将输出粘贴到的每个JSON验证器都说JSON无效。谁能告诉我为什么?

{"s924vpmm":{" {"day":30, "dayofyear":334, "daysinmonth":30, "freqstr":"M", "is_leap_year":false, "month":11, "ordinal":574, "qyear":2017, "start_time":1509494400000, "week":48, "weekofyear":48}":50.8188}}

1 个答案:

答案 0 :(得分:0)

您需要对JSON键中的双引号"进行转义:

{"s924vpmm":{"{\"day\":30, \"dayofyear\":334, \"daysinmonth\":30, \"freqstr\": \"M\", \"is_leap_year\":false, \"month\":11, \"ordinal\":574, \"qyear\":2017, \"start_time\":1509494400000, \"week\":48, \"weekofyear\":48}":50.8188}}

现在有效,尽管我会说您的JSON密钥之一是整个字符串化的JSON对象是很奇怪的。