How can visualize Linq result as a Json.
I am working on .net 5 MVC project, try Linq to Entities. I want to get output as a Json. Is that possible in LINQ pad.
Comments
-
Install Newtonsoft.Json in nuget package manager, then:
JsonConvert.SerializeObject(...).Dump(); -
Thanks sdflysha for quick reply. I tried as you explain. but i got this error after that. any idea how to solve this.
-
I found a solution for that.
Note: previously I use FirstOrDefaultAsync , then I change it to FirstOrDefault , Also modified SerializeObject() as in screenshot.Anyone know how to get Json with FirstOrDefaultAsync() it would really appreciate.
Thanks
-
Actually it's nothing to do with
LINQPad
, justawait
theFirstOrDefaultAsync()
result, you'll get a correct result. -
@sdflysha said:
Actually it's nothing to do withLINQPad
, justawait
theFirstOrDefaultAsync()
result, you'll get a correct result.Thanks sdflysha , I will try that too as well.