a:2:{s:7:"session";s:13:"505a6f3812a81";s:7:"success";s:4:"true";}
json 格式为
{"session":"505a6f3812a81","success":"true"}
'a:2:{s:7:"session";s:13:"505a6f3812a81";s:7:"success";s:4:"true";}'.replace(/(s:\d+:("\w+");s:\d+:("\w+");)/g,"$2:$3,").replace(/a:\d+:\{(.*),\}/g,"{$1}")
这是用JS正则替换的,你改成C#的就行了。
====我改好吧:
Regexp.Replace( Regex.Replace(xxx,"(s:\\d+:(\"\\w+\");s:\\d+:(\"\\w+\");)","$2:$3,"), "a:\\d+:\\{(.*),\\}", "{$1}" )
JSON.NET
javascriptserializer