|
本帖最后由 bigestyjoy 于 2015-1-6 16:32 编辑
你好,我想反馈一个问题:
我用水文工具集的类模块处理以下数据,出现问题。
- {
- "total": 393,
- "data": [
- {
- "Hospital": {
- "ParentId": "a4f9f5b8-733d-4724-979c-a7a3f664e9ed",
- "Id": "0102",
- "CreateTime": new Date(
- 1371480749000
- )
- },
- "HospitalEmployeeNo": "0001",
- "Id": "27563",
- "CreateTime": new Date(
- 1376064000000
- ),
- "CreateUser": "ADMIN",
- "UpdateTime": new Date(
- 1402286180000
- ),
- "UpdateUser": "admin"
- }
- ]
- }
复制代码
经琢磨,发现是上述代码中【new Date】部分的问题。水文工具集的类模块缺少处理这类型Value的部分,当它发现“n"字符后,按照“null”处理,忽略了还可能是“new”的情况。
于是自行添加了部分代码(下面行15-19),避免了错误(忽略new语句方法)
- Private Function parseValue(ByRef str As String, ByRef index As Long)
- Call skipChar(str, index)
-
- Select Case Mid(str, index, 1)
- Case "{"
- Set parseValue = parseObject(str, index)
- Case "["
- Set parseValue = parseArray(str, index)
- Case """", "'"
- parseValue = parseString(str, index)
- Case "t", "f"
- parseValue = parseBoolean(str, index)
- Case "n"
- If Mid(str, index + 1, 1) = "u" Then
- parseValue = parseNull(str, index)
- Else
- index = index + InStr(Right(str, Len(str) - index + 1), ")")
- End If
- Case Else
- parseValue = parseNumber(str, index)
- End Select
- End Function
复制代码
|
|