3
I have a string in json format.
In this way:
{"IdLead":4186960,"Concessionaria":"Mila - Centro","DadosQualificacao":{"IdEvento":79654,"Qualificacao":1,"Motivo":6,"DescricaoMotivo":"motivo 1234","Ficha":["aaaaaaaa - TESTE","Ação desejada:=123456789 teste 132456789","Data Agendamento Test-Drive:=20/04/2018","Já é Cliente da Marca?=SIM"]},"DadosPessoa":{"Nome":"Guilherme Martins","Email":"[email protected]","DDD":11,"Telefone":948831041,"CpfCnpj":"44436740803","PreferenciaContato":0}}
I need to show this string on my screen, however, it appears on a same line. I would like to know how to create this string to show in the identato format.
So Leticia, I don’t have an object, I have a string already with the JSON pattern, but in my HTML I want to show this string in this indented format
– Guilherme Nunes
@Guilhermenunes use a tag
<pre>
which says that the text within it already has a format to be shown.– Lucas
@Leticia: So it didn’t roll; It thus formats a json object, and if you pass a string it just add a / between the data.
– Guilherme Nunes
@Lucas, it seems so cool, but he breaks the line where there is space, and this my stirng has no space between the data...
– Guilherme Nunes
@Guillhermenunes is probably not a space he has but a
\n
(line breaking). You can test withmeuJson = meuJson.Replace("\n","")
– Lucas
On the JSON.Net website I put the link you can find several examples of how to do. But here is the direct link to the examples: https://www.newtonsoft.com/json/help/html/SerializeObject.htm
– Leticia Rosa