c# – NewtonJson.Parse with quotation marks down the middle

Question:

I have in the database a column of type varchar that takes a JSON. This column is the description of a company, but in 4 languages. The logic I have is as follows:

{  
    "PT":"Descrição com "aspas" quebra o meu código",  
    "ES":" ",  
    "FR":"fr ",  
    "EN":" en"  
}

How do I get JSON` to read correctly when I have quotes in the company description?

Answer:

You need to "escape" the quotes you have in your string by using the backslash \ before the quotes.

{  
    "PT":"Descrição com \"aspas\" quebra o meu código",  
    "ES":" ",  
    "FR":"fr ",  
    "EN":" en"  
}
Scroll to Top