This is first time that I work with json. I am trying to return Json from my action method:
public JsonResult Upload()
{
...
return Json(new { foo = "sos....sos....sos..."});
}
But in result all I get is my message wrap in this "pre" tag. How to parse "foo" from this?
"<pre style="word-wrap: break-word; white-space: pre-wrap;">{"foo":"sos....sos....sos..."}</pre>"
I think the reason you are receiving the data wrapped in a pre tag is because you are requesting the data as HTML and not plain text or json.
Try specifying the data type as json to stop the response being converted to HTML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With