如何解析JavaScript中的JSON以获取价值 [英] How to parse JSON in JavaScript to take value

查看:80
本文介绍了如何解析JavaScript中的JSON以获取价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的被困在解析JSON字符串并获取其值.我得到的JSON字符串为

I am really stuck in parsing a JSON string and take it's values. I got the JSON string as

{"user":{"id":"1","firstname":"Freelogin","created":"0000-00-00 00:00:00","lastname":"Administrator","email":"fred@websecurify.com", "usergroup_id":"1","status":"1","ip_enable":"N","priv":"0","expire":""},"data":{ "1":{"5":{"last_update":"2010-12-13 16:16:16","status":"0"},"3":{"last_update":"2010-12-13 16:41:48","status":"1"}},"2":{"6":{"last_update":"2010-12-13 16:41:48","status":"1"}}},"server_array":[{"id":"1","name":"anes.yyy.net"},{ "id":"2","name":"neseema.xxx.net"}],"service_array":[{"id":"5","name":"POP3"}, {"id":"6","name":"Cpanel"},{"id":"3","name":"SMTP"}],"sort_by":"servername", "sort_order":"ASC","pagelinks":"","totrows":"2","offset":"0","limitvalue":"10", "rows_monitor":2,"current":"monitor","uri":false}

如何解析此结果并将结果进一步 用JavaScript处理

How to Parse this and take the Results for further processing in JavaScript

推荐答案

您应使用 jQuery.parseJSON .如果可用,它将使用本地JSON ,并且在进行健全性检查后,仅在必要时使用eval.

You should use jQuery.parseJSON. It will use native JSON if available, and only use eval if necessary, after a sanity check.

这篇关于如何解析JavaScript中的JSON以获取价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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