語法:[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