JSON Serialization and Deserialization in Flutter | Convert to JSON | Flutter Tutorial | Hindi
HTML-код
- Опубликовано: 21 авг 2024
- Sign up for 10,000 free minutes: bit.ly/3jyzOPl
Find out more about ZEGOCLOUD: bit.ly/3VFR96F
How to build video call app: bit.ly/3WLEbVO Instagram: / rohitsemriwal
In this video we'll be taking a look at JSON serialization and de-serialization in Flutter. This video will help you find answers to questions like:
1. What is JSON serialization?
2. What is deserialization?
3. How to serialize in Flutter?
4. How to convert an object to JSON in Flutter?
If you wanna learn 1 on 1 from me, DM me on Instagram: @rohitsemriwal / rohitsemriwal
Don't forget to subscribe to the channel, so you don't miss out on any future updates.
Forgot to zoom in the code😂, will fix it in the next one.
www
Very nice explanation thankyou so much, everything is clear 🙏🏼🙏🏼🙏🏼
Bhot bhot thank u apka jo apne ye explain Kiya wo b bhot acche way m
You taught very well sir .
Thank you very much sir 💓 ❤️❤️❤️
Thanks you so much brother you are clearing all my doubts 😭😭😭👍👍
Glad I could help 😁
Always good explanation and supportive attitude.
Thankyou 👍
My pleasure!
Useful video
very helpfull bro i like these tutorial instead of ui building
Thanks a lot! Glad I could help 😁
Well explained
well we can use dart:convert too, why make it so complicated? idk lemme know if m missing on something, just call on jsonDecode(jsonStr), and jsonEncode(jsonStr), and ig ur work is done?
jsonDecode(jsonStr) takes the JSON string and converts it to a Map/Array in Dart/Flutter.
jsonEncode(obj) takes the Map/Array and converts it to a JSON String (reverse of jsonDecode).
But when using custom models(classes).. let's say a UserModel, it is required to convert it to a map first before encoding it to a JSON String.
Same goes for the decoding, jsonDecode(str) will decode the String and give us a map.. but we'll have to assign the values from the map to the corresponding properties in your custom class.
So basically, jsonEncode and jsonDecode work with Maps and Strings only.
Adding custom classes introduces a new level of conversion to be done.
Your statement is true only if you're using Maps for everything in your app, which is just not recommended at all.
@@RohitSemriwal yeah, here's what gemini had to say, i mean yeah we shouldn't practice something like that, technically Flutter can understand and work with JSON data directly using objects. However, converting JSON to custom Dart objects offers several advantages over relying solely on maps:While directly using maps for JSON data is technically possible in Flutter, it's generally recommended to create custom objects for the reasons mentioned above. The extra step of conversion provides benefits in terms of type safety, code readability, maintainability, functionality, and library integration.
@@abhayshandle Exactly!
👍👍👌👌please one real world example...
Check out my Crypto Tracker series.
Thank you so much 👍
You are welcome
Sir, dart stream, single subscription, Broadcast stream, why use explain in more detail हिंदी भाषा
Please make video on retrofit chopper for flutter json fetch thank you
Can you please make a video on crud operations using Bloc?
keep it up brow u are awsome
Thanks a lot 😁
sir mere 3 Question hai
1)vscode me flutter app bna ny k liye android studio ko install krna
or android studio me uski sdk android version ko bi download krna zarori hota hai kia ya flutter ki sdk hi thk hai
2) android studio k bagair apna mobile vscode me connect kr sakhty hai flutter app launch krny k liye
3) flutter app ko pc coreDu2 windows 32 bit me bna sakhty hai
1. Haan Android Studio install Krna zaroori h kyuki flutter code end me compile Android studio ke SDK se hi hota h.
2. Baat sirf Android Studio ki nhi h, Android studio ke sath sath bohot saari aur cheezein jaise command line tools, platforms, SDKs aur sab aata h. Uski wajah se wo to use Krna hi padega. Uske bina ye sab alag se install krne me saalon jaaenge😂
3. Nhi bana skte, aur agar bana skte h to bohot bura experience rahega.
@@RohitSemriwal thanks
@@RohitSemriwal java bi install krna hai
@@ShahzaibKhan-wh5hh haan Java JDK bhi important h
@@RohitSemriwal thanks bro apky channel ko subscrieb kr dia hai
tq....
👑
When you are starting series of getX state management with flutter ?
Got it on my list, will keep you updated 😁
Thanks
Glad I could help 😁
Thank-you
🙏🏽😄
Automated serialization using code generation
api calling using json serialization video pls
Amazing.
Thanks a lot 😁
Sir iam very confused how to fetch complex data from api like nested objects , fetch data from list of array. Can. U give me some hint or idea like how to deserialize nested objects clearly
I'll make a video on that as soon as I'm done with the Chat App Series that's currently in progress on the channel. Thanks for watching 🙏
@@RohitSemriwal please sir make on video on how to fetch complex data from api like nested objects , fetch data from list of array.