查看: 4857|回复: 4

[问与答] 怎么读取这段Json

[复制链接]
天上地下 发表于 2015-12-28 23:07:37 | 显示全部楼层 |阅读模式
{"role":"\u65b0\u624b05580425","level":"3","accountId":"500666114","account":"xiaoshenyang","gold":{"node":{"3":2800}},"status":"0","msg":"\u6210\u529f\u65e0\u4fe1\u606f"}500666114

目前需要读取gold里的node中的2800数据。


我使用以下的代码来解析Json,但无法进一步读取我需要的node的数值。
  1. Dim scriptCtrl
  2. Function parseJSON(str)
  3.         If Not IsObject(scriptCtrl) Then
  4.                 Set scriptCtrl = Server.CreateObject("MSScriptControl.ScriptControl")
  5.                 scriptCtrl.Language = "JScript"
  6.                 scriptCtrl.AddCode "function ActiveXObject() {}" ' 覆盖 ActiveXObject
  7.                 scriptCtrl.AddCode "function GetObject() {}" ' 覆盖 ActiveXObject
  8.                 scriptCtrl.AddCode "Array.prototype.get = function(x) { return this[x]; }; var result = null;"
  9.         End If
  10.   On Error Resume Next
  11.         scriptCtrl.ExecuteStatement "result = " & str & ";"
  12.         Set parseJSON = scriptCtrl.CodeObject.result
  13.   If Err Then
  14.         Err.Clear
  15.         Set parseJSON = Nothing
  16.   End If
  17. End Function
复制代码




请教各们高手帮助解答一下。


谢谢。
 楼主| 天上地下 发表于 2015-12-28 23:09:13 | 显示全部楼层
set odj = parseJSON(gamgeJson)
WriteA odj.accountId & "<br />"

外层的数据都可以正常读取,就是不知道怎么读取gold里的node中的2800数值。
xuanxiao 发表于 2015-12-28 23:11:32 | 显示全部楼层
set odj = parseJSON(gamgeJson)
WriteA odj.accountId & ""

外层的数据都可以正常读取,就是不知道怎么 ...
天上地下 发表于 2015-12-28 23:09



   很晚了,明天看下答复你
密山人 发表于 2016-1-7 08:37:25 | 显示全部楼层
Rapid D3.js
xuanxiao 发表于 2016-2-5 00:26:54 | 显示全部楼层
Rapid D3.js
密山人 发表于 2016-1-7 08:37



   http://www.ttasp.net/article/2/11/201411/216.html 参考下
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表

在线客服

售前咨询
售后咨询
服务热线
023-58418553
微信公众号