I will forever pronounce it Jason and I will die on this hill!
@dand448511 ай бұрын
Hahah it all matters how you say "data", or is coke, soda, pop.... Hahah... 🤪
@LahceneBelbachir9 ай бұрын
Same here, and since even Douglas Crockford himself always called it Jason, I think we're good.
@kylewatson5133 Жыл бұрын
Json serialization of c# classes is incredibly powerful....
@ryfatron3963 Жыл бұрын
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?
@pbible Жыл бұрын
James Rocks!!
@vencislavvidov Жыл бұрын
What about deserialize complex object containing List or Dictionary of others complex nested objects? For example an Invoice:)
@nuthanmurari Жыл бұрын
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.
@rusektor Жыл бұрын
17:42 Instead of using some dummy statement, you could equally use empty statement with one semicolon in the beginning of the line. 😉
@alfflasymphonyx Жыл бұрын
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.
@JamesMontemagno Жыл бұрын
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
@alfflasymphonyx Жыл бұрын
@@JamesMontemagnoCorrect. I guess a function DeserializeFromFile would do
@phizc Жыл бұрын
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.
@dotnet Жыл бұрын
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.
@leppyr6411 ай бұрын
Love the comedy of how hard you're trying say JSON and not Jason.
@RamonDeKlein Жыл бұрын
Why dispose it manually? Use “await using” instead. Disposing it twice doesn’t make it more safe, just more complex, so it’s bad.
@JamesMontemagno Жыл бұрын
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
@enriquebenedicto9429 Жыл бұрын
Not sure I understand why it needed to be Async
@RamonDeKlein Жыл бұрын
File or network I/O may block, so async may be useful if scalability is important.
@enriquebenedicto9429 Жыл бұрын
@@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.
@JamesMontemagno Жыл бұрын
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.
@vivekkaushik9508 Жыл бұрын
Why did James loose his long curly hair?
@JamesMontemagno Жыл бұрын
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.
@VictorPraizTech Жыл бұрын
so thoughtful of you @@JamesMontemagno
@ibrahimhussain3248 Жыл бұрын
Where's James Newton King?
@JamesMontemagno Жыл бұрын
Working on the ASP.NET Core team twitter.com/JamesNK