Gson Tutorial - Mapping of Arrays and Lists of Objects

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ก.พ. 2025

ความคิดเห็น • 77

  • @vinodreddy
    @vinodreddy 7 ปีที่แล้ว +3

    Great work Norman. please continue your work on these.

  • @MirrorsEdgeGamer01
    @MirrorsEdgeGamer01 7 ปีที่แล้ว +3

    Thank You, I first found Gson complicated but you showed me how easy Gson is to use; now I Love it. Thanks for these great tutorials. :)
    Edit: Thanks for heart.

    • @FutureStudio
      @FutureStudio  7 ปีที่แล้ว

      I'm very happy to hear that :) Thank you!

  • @ForcesOfOdin
    @ForcesOfOdin 5 ปีที่แล้ว +1

    This really helped me to create the skeleton class for a JSON -> Java Object dump that I needed. The key was the realization that { } surrounds Java Objects and that I could just embed private classes in the outer class shell. Thank you so much for making this video.

  • @codinginflow
    @codinginflow 7 ปีที่แล้ว +10

    Great video! By serializing ArrayLists into JSON we can also save them as Strings in SharedPreferences, which is pretty cool

    • @FutureStudio
      @FutureStudio  7 ปีที่แล้ว

      Yep, I've serialized objects to JSON to store them in SharedPreferences too!

    • @ottoduke8942
      @ottoduke8942 3 ปีที่แล้ว

      you probably dont give a shit but if you are bored like me atm then you can watch all of the new series on InstaFlixxer. Been streaming with my girlfriend during the lockdown :)

    • @brysonavi2500
      @brysonavi2500 3 ปีที่แล้ว

      @Otto Duke definitely, I have been using instaflixxer for years myself :)

  • @bernardlomo2334
    @bernardlomo2334 7 ปีที่แล้ว +1

    Thank you Norman. Have a Blessed Week!

    • @FutureStudio
      @FutureStudio  7 ปีที่แล้ว +1

      +Bernard Lomo thank you. I appreciate it :)

    • @bernardlomo2334
      @bernardlomo2334 7 ปีที่แล้ว

      You are welcome!

  • @battlemode
    @battlemode 3 ปีที่แล้ว +1

    Superb explanation. Very thorough and helpful. Thanks!

  • @muhammadhassan3058
    @muhammadhassan3058 4 ปีที่แล้ว

    Sir your style is very great of speaking and teaching is very great

  • @torpid0
    @torpid0 3 ปีที่แล้ว

    Thank you a lot man! That thing with TypeToken explanation was sooooo helpful!

  • @formerterrace5046
    @formerterrace5046 7 ปีที่แล้ว +1

    Great video was stuck in this for a day watched your video and solved in a few minutes. Thanks a lot keep up the good work :D

  • @adamszachtsznajder8893
    @adamszachtsznajder8893 2 ปีที่แล้ว

    This was exactly what I have looking for. Thx!

  • @1komentator
    @1komentator 3 ปีที่แล้ว +1

    It's simply amazing. I never had any experience with json at all and now i'm able to work with them (i connected to iss_station api and got list of astronauts currenty in space). THANK YOU

  • @jayeshborgaonkar9166
    @jayeshborgaonkar9166 6 ปีที่แล้ว

    really nice and clean explanation for the topic, keep going !!!

  • @inihearxpenguin8079
    @inihearxpenguin8079 ปีที่แล้ว

    Thank you so much norman, you've helped me so much on my project

  • @RaftDev
    @RaftDev 2 ปีที่แล้ว

    Thank you SO MUCH i'm trying to make that for HOURS that help me so much

  • @todosistemas344
    @todosistemas344 3 ปีที่แล้ว

    The United States has a very good education, this video is very good, thanks for making this type of videos, I subscribe to the channel

  • @amrh4259
    @amrh4259 6 ปีที่แล้ว

    thanks a lot, I really like every single tutorial video you did
    thanks

  • @Mohamed-uf5jh
    @Mohamed-uf5jh 6 ปีที่แล้ว

    You explain very perfect,great job

  • @lukasz.kaszuba
    @lukasz.kaszuba 11 หลายเดือนก่อน

    Nice work! Thx a lot, Norman :)

  • @techfarmers
    @techfarmers 5 ปีที่แล้ว

    thanks bro, really helpful and thorough video

  • @alertys
    @alertys 6 ปีที่แล้ว

    You solved my problem. I was using list instead of array and didn't know why it was not working. Thanks!

  • @5b2c950
    @5b2c950 6 ปีที่แล้ว

    LOVE THIS SERIE SO MUCH! THANKS!

  • @mickdostie
    @mickdostie 5 ปีที่แล้ว

    Excellent tutorial, loved it. Just want to add that people using Eclipse IDE can see the objects created by ''Founder[] founders = new Gson().fromJson(founderJson, Founder[].class);" with the debug perspective (Top right, bug icon), then by hovering over "founders" and it will then show you the contents. InteliJ seems to be much more complete, and people following along with other IDEs might get confused, on how to see if creating the Arrays from the founderJson string worked.
    One can also use "System.out.println(Arrays.toString(founders));" to see print the output

  • @akhilgada602
    @akhilgada602 6 ปีที่แล้ว

    Very helpful video. Thanks for it.

  • @yonki-delos-inciensos
    @yonki-delos-inciensos 4 ปีที่แล้ว

    You know, I've been struggling with deserialization, receiving an error while trying to deserealize a response and when I watched your video I realized I forgot to threat an array as a list in my model haha. Cool videos by the way!

  • @cholschuh
    @cholschuh 7 ปีที่แล้ว

    Another great one! Thank you

  • @johnsonabiaeme9018
    @johnsonabiaeme9018 5 ปีที่แล้ว

    You saved my day. Thanks man

  • @Unconvinient
    @Unconvinient 5 ปีที่แล้ว

    Good explanation , something is going to come after a little bit practise;

  • @franciscoicarocs
    @franciscoicarocs 5 ปีที่แล้ว

    Thanks for the help, mate.

  • @AngryBacteria
    @AngryBacteria 2 ปีที่แล้ว

    How did you quick format the json text files. That was really useful

  • @shailendrakk6226
    @shailendrakk6226 4 ปีที่แล้ว +1

    Great video.Also can u post a video for accessing nested Json Array using JAVA?

  • @i7HX
    @i7HX 4 ปีที่แล้ว

    Thank you dude.

  • @RamHomier
    @RamHomier 7 ปีที่แล้ว +1

    Thanks for this tutorial, I can't find the way to do similar stuff in eclipse. Mainly the list of variables you have at the bottom, I have to do a println to see a variable value. Also how do I view the generated json string in a formatted way like you do?

  • @lucaherrmann77
    @lucaherrmann77 3 ปีที่แล้ว

    Thx for the Video!

  • @lwach87
    @lwach87 7 ปีที่แล้ว

    Great tutorial! Thank you :)

  • @mrmarnic9393
    @mrmarnic9393 6 ปีที่แล้ว

    I have a question
    At 12:06 why do you need to do this Type thing
    I tried it with only List.class and it has worked

  • @jairomejia616
    @jairomejia616 4 ปีที่แล้ว

    Your videos are really great, I don't know if you know, but there are available as documentation from the official Gson Github. Your accent is not a problem, please don't heard the people who said that it is a problem.

  • @akshaybhasin6110
    @akshaybhasin6110 7 ปีที่แล้ว

    Great tutorial... Thanks

  • @NingamerX
    @NingamerX 4 ปีที่แล้ว

    You saved my life XOXO

  • @karangupta2924
    @karangupta2924 7 ปีที่แล้ว +1

    Hi.You were great.Subscribed. Can you do a video where we have a very large set of Json to extract.Do we follow the same procedure ?

    • @FutureStudio
      @FutureStudio  7 ปีที่แล้ว

      Hi, awesome, thank you!
      Depends on what you mean with "very large". What size are we talking about?
      If the set is too large to load into memory, you can use Gson's streaming option to load and parse it on the fly. That should work even for very large data sets!

    • @MirrorsEdgeGamer01
      @MirrorsEdgeGamer01 7 ปีที่แล้ว

      What about a JSON file with, potentially, over 50

  • @GawblyOG
    @GawblyOG 6 ปีที่แล้ว

    Loving these videos! Could you post a jar to your intellij settings?

  • @mehadihossain1508
    @mehadihossain1508 7 ปีที่แล้ว

    Thank you.
    Please post a video on null values, as early as possible.

  • @argeanualin-mihai699
    @argeanualin-mihai699 7 ปีที่แล้ว +1

    Nice job!

    • @FutureStudio
      @FutureStudio  7 ปีที่แล้ว

      +Argeanu Alin-Mihai thanks :)

  • @haresuper6513
    @haresuper6513 7 ปีที่แล้ว +1

    What's the short key to format and beautify json?

    • @FutureStudio
      @FutureStudio  7 ปีที่แล้ว

      It's the "reformat code" shortcut. Mac: Command+Option+L, Windows: Ctrl+Alt+L. We have a video on it: th-cam.com/video/KRDJXKt4bTk/w-d-xo.html

  • @gururaj5098
    @gururaj5098 5 ปีที่แล้ว

    Hi thanks for this tutorial. How to get Values from the object during deserialization. I need to get Values from JSON and to store them in string variable

  • @piyushkhandelwal6582
    @piyushkhandelwal6582 5 ปีที่แล้ว

    thankyou bro.....so helpul

  • @emergingtechinfo4980
    @emergingtechinfo4980 4 ปีที่แล้ว

    Its great video & nice.

  • @aubame-bloodclut-zette6745
    @aubame-bloodclut-zette6745 6 ปีที่แล้ว

    What should I do if my json file is an object which contains fields as well as a list of objects?

  • @nahuelpenalva5304
    @nahuelpenalva5304 ปีที่แล้ว

    Gracias GENIO!

  • @evertongreeff3959
    @evertongreeff3959 5 ปีที่แล้ว

    Amazing!!!!

  • @ramnarayanpatro1772
    @ramnarayanpatro1772 7 ปีที่แล้ว

    What key are you using to see the packages at bottom ??? once you do the fromJson()

    • @FutureStudio
      @FutureStudio  7 ปีที่แล้ว

      What do you mean by packages?

  • @danny10846
    @danny10846 6 ปีที่แล้ว

    Hi Future Studio,
    I'm trying to compare my 'name' variable that now holds my JSON data, and another String I've created, but every string comparison method I've tried has failed. I've seen that gson has a getAsString() method but I'm not sure how it works, could you help me at all?

  • @suhailbashir7683
    @suhailbashir7683 7 ปีที่แล้ว

    I am having a problem while I am populating the bean class.I have lots of nested objects and some objects are dynamic in nature.{fields itself are dynamic: values usually are dynamic}How do I tackle this situation?

  • @path_ethics
    @path_ethics 6 ปีที่แล้ว

    Thank you sir!

  • @atulkumarsingh4919
    @atulkumarsingh4919 7 ปีที่แล้ว

    I have an Json array to be send to server in order to store it's values in the database ,but i'm unable to do so as iam getting an error and i'm unable to send the object could please help me out ?

    • @FutureStudio
      @FutureStudio  7 ปีที่แล้ว

      Hi! We can't really help without knowing the exact error. Stackoverflow is probably the best way to quickly get quality help.

  • @THE16THPHANTOM
    @THE16THPHANTOM 7 ปีที่แล้ว

    i have a Tree structure json. im screwed. guess its back to manual toString mode. i thought i could escape all the work i have to do by using this library. i have skip half since there is not problem converting to json.

    • @FutureStudio
      @FutureStudio  7 ปีที่แล้ว

      You can write custom parsers for Gson and still enjoy a lot of the automation. I wouldn't give up yet!

  • @akhilgada602
    @akhilgada602 6 ปีที่แล้ว

    Listening to the noise of keyboard, I can say that it is butterfly keys of new Macbook Pro :-). Am I right?

  • @prosto_komputer
    @prosto_komputer 6 ปีที่แล้ว

    😎Really thank you! 😎

  • @gekoskipatric
    @gekoskipatric 7 ปีที่แล้ว

    Very concise and informative. Thank you for this tutorial. You saved my a@$! On a side note, how did you get intelliJ to format your JSON output? Can I do that in Android Studio sense it's basically based on intelliJ?

    • @FutureStudio
      @FutureStudio  7 ปีที่แล้ว

      Glad it helped! Yes, the formatting also works in Android Studio (ideally in a .json file). I used the "Code -> Reformat Code" shortcut.

  • @perfectlyfantastic
    @perfectlyfantastic 7 ปีที่แล้ว +1

    thanks man (y)

  • @Programming_Dasturlash
    @Programming_Dasturlash 2 ปีที่แล้ว

    Yanada yaxshiroq kanteklar ham chiqaring

  • @ayoubanbara1685
    @ayoubanbara1685 5 ปีที่แล้ว

    good

  • @fresque
    @fresque 6 ปีที่แล้ว

    Sos un groso, sabelo