I will forever pronounce it Jason and I will die on this hill!
@dand44859 ай бұрын
Hahah it all matters how you say "data", or is coke, soda, pop.... Hahah... 🤪
@LahceneBelbachir7 ай бұрын
Same here, and since even Douglas Crockford himself always called it Jason, I think we're good.
@kylewatson513311 ай бұрын
Json serialization of c# classes is incredibly powerful....
@ryfatron396311 ай бұрын
Can we take the json file to deserialize into sth, Object, but we don't have that Class Template at first? Can we generate that Class along the Deserialization?
@nuthanmurari10 ай бұрын
I am happy to see this .NET works really hard in system.Text.Json in a wider way to use it. Advantage here is : No need of external library called Newtonsoft.Json Cons: How confident we are with System.Text.Json. Whether we good to go on usage with our inbuilt library? Please let us know everyone on this and from which .net version and c# language it supports all the functionality of NewtonSoft.Json in our inbuilt library. If you give that confidence to all dotnet programmers or architects we are really happy to use it with replacement of matured Newtonsoft.Json.
@vencislavvidov11 ай бұрын
What about deserialize complex object containing List or Dictionary of others complex nested objects? For example an Invoice:)
@rusektor11 ай бұрын
17:42 Instead of using some dummy statement, you could equally use empty statement with one semicolon in the beginning of the line. 😉
@phizc11 ай бұрын
17:18 The reason it didn't hit the breakpoint is that it hit a breakpoint at the setter of the `Date` property on the WeatherForecast class. VS Code probably got confused by the breakpoint on the empty line. You just terminated the program too soon. The code was perfectly fine. `Deserialize` isn't an async method, so you didn't need the `await`. So the only "shocking" thing is that you used *non-async* file IO. Shudder /s. My best guess is that since the breakpoint was at the empty line 16, it moved the breakpoint to the first line that could have a breakpoint, which was the property at line 19. Stupid that VS Code would allow breakpoints on empty lines in the first place.
@dotnet11 ай бұрын
Yup, @JamesMontemagno commented to a few others and we added this small correction in the video details: Correction: 00:17:18 Async isn't actually required here, the breakpoint didn't hit due to the program executing too soon and adding the Console.WriteLine would have fixed this up, although with File IO access async operations should be considered.
@alfflasymphonyx11 ай бұрын
And @16:58, similarly, just pass the filename to Deserialize instead of a FileStream. The FileStream should be used internally. I should not need to provide it.
@JamesMontemagno11 ай бұрын
I don't think you an d just pass in the file name, if you pass in just a string it will try to deserialize that string: learn.microsoft.com/en-us/dotnet/api/system.text.json.jsonserializer.deserialize?view=net-8.0
@alfflasymphonyx11 ай бұрын
@@JamesMontemagnoCorrect. I guess a function DeserializeFromFile would do
@pbible11 ай бұрын
James Rocks!!
@enriquebenedicto942911 ай бұрын
Not sure I understand why it needed to be Async
@RamonDeKlein11 ай бұрын
File or network I/O may block, so async may be useful if scalability is important.
@enriquebenedicto942911 ай бұрын
@@RamonDeKlein yeah. I understand that. What I don't understand is that he implied it hadn't worked on the first try, because he hadn't used async. I can't imagine that being the case. But maybe I just missed some other comments he made.
@JamesMontemagno11 ай бұрын
It would work either way. The main issue I ran into and couldn't' fix in edit was that I didn't have anything to break on after. So once I added the Console.WriteLine the breakpoint would have been hit. Although I would suggest async/await when handling this as it could be a very large JSON blob.
@leppyr6410 ай бұрын
Love the comedy of how hard you're trying say JSON and not Jason.
@RamonDeKlein11 ай бұрын
Why dispose it manually? Use “await using” instead. Disposing it twice doesn’t make it more safe, just more complex, so it’s bad.
@JamesMontemagno11 ай бұрын
Just me following docs :), but yes an await using would also work. the using will just call Dispose, but not DisposeAsync. I made a PR: github.com/dotnet/docs/pull/38948
@vivekkaushik950811 ай бұрын
Why did James loose his long curly hair?
@JamesMontemagno11 ай бұрын
I was heading out on holiday and knew i was going to do a lot of swimming so decided it was time. It was 12" total and I donated it to a charity where they make wigs for kids and cancer patients.
@VictorPraizTech11 ай бұрын
so thoughtful of you @@JamesMontemagno
@ibrahimhussain324811 ай бұрын
Where's James Newton King?
@JamesMontemagno11 ай бұрын
Working on the ASP.NET Core team twitter.com/JamesNK