开发者

How to get the JSON-string value of a complex object?

I use jQuery to get jsonData from the server. I don't know what the data is. I would like to get the string value of the JSON object and write it in a textarea tag so I can debug. How? Please and thank you.

P.S开发者_JAVA技巧. I am using .NET MVC and jQuery


You could convert it back to JSON:

$("the_textarea").val(JSON.stringify(data));

It's actually quite readable.

Or use a tool like Firebug to dump it:

console.log(data);


If you plan on using JSON.stringify you should include json2.js to support older browsers.

Another route to solving your problem is to use firebug. It can show you each request along with the incoming and outgoing data.


for most modern browsers (except IE <= 7) you can use JSON.stringify(object)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜