"{"A":"5","B":"4","C":"3","D&q

Posted gxivwshjj

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了"{"A":"5","B":"4","C":"3","D&q相关的知识,希望对你有一定的参考价值。

转自 https://segmentfault.com/q/1010000007144114/a-1020000007144741

取键

‘{"A":"5","B":"4","C":"3","D":"2"}‘.match(/"\w+"\:/g).map(function(el){return el.slice(1,-2)})


["A", "B", "C", "D"]

取值

‘{"A":"5","B":"4","C":"3","D":"2"}‘.replace(/(?:"[^"]+":)|["{}]/g,‘‘).split(‘,‘)
["5", "4", "3", "2"]
str = ‘{"A":"5","B":"4","C":"3","D":"2"}‘;
str.split(/(?:^\{|",)"[^"]+":"|"\}$/g).slice(1,-1)
["5", "4", "3", "2"]
str.split(/[{"][^:]+:"|"\}/g).slice(1,-1)
["5", "4", "3", "2"]

 

以上是关于"{"A":"5","B":"4","C":"3","D&q的主要内容,如果未能解决你的问题,请参考以下文章

log4j:ERROR A "org.jboss.logging.appender.FileAppender" object is not assignable to a &quo

android gson怎么解析这样的json数据 "code":"00","result":"corpid":&quo

linux shell 脚本 wak语句中 awk 'BEGIN FS="'"'"'";RS="\n&quo

java.security.AccessControlException:access denied("java.io.FilePermission" "文件路径&quo

Laravel Passport 基本 api 身份验证返回 "error":"invalid_client","message":&quo

Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type&quo