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

sql server - MSSQL Text and Varchar(MAX) fields shown (MEMO) in DBGrid -

qml - Is it possible to implement SystemTrayIcon functionality in Qt Quick application -

php - Changing the visibility scope of parent methods in child classes -