[JSON].set(keyPath, value)

语法:[JSON].set( keyPath, value )

返回:[True | False]

说明:设置键值

参数:

    keyPath    [keyPath 必需] 键名路径字符串

    value    [任意类型 必需] 值

示例:

Set jsonObj = toJson()
jsonObj.set "title", "hello,word!" ' 赋新值,返回True
jsonObj.set "title", "ni hao!" ' 更改已存在的键值,返回True
jsonObj.set "price.test", "A" ' 返回False,因为price键不存在
jsonObj.set "title.test", "A" ' 返回True,title父键存在,然后新建子键test
Response.Write jsonObj.value("title")

注意:

a)如果键名路径已存在,则更新该值,返回True

b)如果键名路径不存在,则返回False

c)当该键的父路径存在时,但键不存在,则新建该键并赋值,返回True

posted @ 2018-11-18 22:56  1024记忆  阅读(1575)  评论(0编辑  收藏  举报