JSON.stringify返回[] [英] JSON.stringify returning []

查看:160
本文介绍了JSON.stringify返回[]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么 JSON.stringify()返回:

[]

jQuery也是如此: $。JSON.encode()

The same happens with jQuery: $.JSON.encode()

可能导致这种情况的原因是什么?我传入一个简单的对象数组,其中每个对象都有字符串属性。我已经循环并提醒每个对象属性,所有看起来都很好,但由于某种原因,两种编码方法都返回 []

What could cause this? I am passing in a simple array of objects, where each object has string properties. I have looped through and alerted each objects properties and all looks fine, but for some reason both the encode methods are returning [].

推荐答案

在数组声明中

var count_review= new Array() 

而非此次使用

var count_review={}; 

一切正常!

这篇关于JSON.stringify返回[]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆