Amin Saadati 2 Amin Saadati 2 - 3 months ago 13
JSON Question

json I/O IN SQL SERVER

i insert Serialize data to SQL server For Example => Serialize :

"{\"Array\":\"Srvice\",\"Setting\":[{\"Id\":1},{\"Id\":2},{\"Id\":3},{\"Id\":4}]}"


above value exists in database .

Now , I read it with linq to EF IN ASP.NET MVC and my output is

"\"{\\\"Array\\\":\\\"Srvice\\\",\\\"Setting\\\":[{\\\"Id\\\":1},{\\\"Id\\\":2},{\\\"Id\\\":3},{\\\"Id\\\":4}]}\""


Why?

Answer

How you insert it and how you read it?

It looks like you insert it without escaping and read with escaping

\ -> \\

" -> \"

Comments