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.
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, just await the FirstOrDefaultAsync() result, you'll get a correct result.
LINQPad
await
FirstOrDefaultAsync()
@sdflysha said: Actually it's nothing to do with LINQPad, just await the FirstOrDefaultAsync() result, you'll get a correct result.
Thanks sdflysha , I will try that too as well.
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.Thanks sdflysha , I will try that too as well.