javascript - Convert string from regexp match into object -


i have following string:

var str = 'jfkdjffddf{aaa:12,bbb:25}kfdjf'; 

and want fetch object it:

var objstr = str.match('/{(.*?)}/')[1]; // aaa:12,bbb:25 

now want use fetched string object:

var obj = json.parse('{' + objstr + '}'); 

do operations on it, convert string again , replace in initial text.

the problem unexpected token a on 1 line in script, problem json.parse.

what's problem, , how can solve this?


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -