javascript - Convert special HTML character codes like " to normal characters -


i have code in .cshtml file outputs json string:

window.teagent = {     id: @user.agentid ,     roles: '@user.roles' } 

but how looks when view page source or call window.teagent javascript:

window.teagent = {     id: 47650 ,     roles: '{"rolesforuser":["agent","wvs"]}' } 

how can convert each " " looks this?

{"rolesforuser":["agent", "wvs"]} 

use html.raw prevent string being html encoded:

window.teagent = {     id: @user.agentid,     roles: @html.raw(user.roles) } 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -