0

so I have a json string within my model data that is sent to the view for display in a table.

I am wanting to be sure it is displayed in a formatted fashion instead of one line string.

My research has led me to find this to be the cleanest method...

string json = JsonConvert.SerializeObject(account, Formatting.Indented);

however, within the view, once my value is extracted to @item.requestExample (the json string to be formatted), can I can call this c# to return the formatted string to the html?

btw, I've tried a few other methods just js, but every time the @item.requestExample is used within the , the inspect/console complains of the invalid tokens of the string since the string it an html representation that is using &quote; instead of "'s.

tia

1 Answers1

0

Maybe you could parse the json (if it is json, I'm not sure I understood well) string into a dynamic object. Then you can iterate over the properties and visualize them at your will.

You can see how to do that here. Deserialize JSON into C# dynamic object