Fork me on github

json和js的相互转化

json转化为js:JSON.parse

    var json = '{"domain" : "sojson.com","author":"soso"}'
    var jsstr = JSON.parse('{ "name":"runoob", "alexa":10000, "site":"m.runoob.com" }');

 

 js转化为json:JSON.stringify

JSON.stringify(jsstr)

 

posted @ 2021-03-17 17:28  我の前端日记  阅读(83)  评论(0编辑  收藏  举报
Copyright © 2021 LinCangHai
Powered by .NET 5.0 on Kubernetes