These Germans are good in making educational tutorials. Am a long time Sub of CodingInFlow and today I SUBSCRIBE TO YOURS TOO. KEEP UP AM LEARNING JSON
Great videos. Could you please make a lecture on junit testing and espresso (not recorded) testing. I am learning from you and you video quality and way of teaching is the best. Honestly you are helping us this is very good moment for us. I don't have money to buy lectures and your lectures are the best one I saw on youtube. Thank you to you and your team (if you have team) for spending your precious time on these videos. #junit #espresso teseting please
Maybe I don't understand smth but what the point of json file if you initialize fields in java code. If some data will change in json file you still working with data in created object. I didn't notice the step of reading json data from the file. Could you pls explain how to do that? And thanks for the video
Suppose you have several JSON files and model classes. Any tips on how I could make deserialization more generic in terms of the arguments that method "fromJson" takes in?
Suppose I have a User Class which have Username(string) and password(string), but while converting this object to json via GSON , i want password to bet get encrypted(say MD5) . Any Idea how to do that?
You could either encrypt the password when it gets set in the object (via a setter or the constructor), or you could try custom deserialization: futurestud.io/tutorials/gson-advanced-custom-deserialization-basics PS: MD5 is not considered safe anymore, so it'd advise against using MD5.
Thanks for great videos ! Im a beginner with coding and have 2 questions: 1- Does the gsonClass (UserSimple) have to have same number of variables with json data ? What happens if UserSimple has 5 different variables and Json has 10 keys ? Can we fetch only 5 keys which we want from Json data ? 2- Does gsonClass(UserSimple) class have to have exactly same variable names with in Json's keys ? I mean, if our Json data has keys like : Json data: { home_team: Real Madrid away_team : Juventus odd_1: 1.60 odd_x: 2,30 odd_2: 3,50 odd_u+2,5 : 1.80 odd_o+2,5 : 2.30 match_time : 18:30 match_date : 20-12-2017 } I think it doesnt have to but if our class has to have same variable names with json data keys, I can not create a variable which has name like : "odd_u+2,5" in Java.
Thank you. Regarding your questions: 1) No, it does not have to be the same number. Gson will only convert the properties your UserSimple class describes. If the JSON has more properties, those will be ignored. In other words, if the JSON has 10 properties, but you only care about five of them, just add those to your Java model. 2) By default, the Java model property has to have the same name as the JSON. However, you can customize it with a simple annotation. The video for it is here: th-cam.com/video/qTXQGmYSazk/w-d-xo.html
Hello and thanks for the nice video! Could i ask you something? If you got and JSON object with 100 attributes is it possible to convert it to a java object where i have only 3 attributes like title,id and date ? Can we somehow match those things ? Or do the Java object has to be exatly the same object like the JSON object ? Thanks, Alex
Hi ! I understood and really appreciate your video man :) But I got an error when I did the same thing as you, I got : "Could not find method compile() for arguments [com.google.gson:gson:2.8.0]" But I have : buildscript { repositories { google() jcenter() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:3.0.1' compile 'com.google.gson:gson:2.8.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } In my build.gradle Does anyone have an idea please ? Have a good day !
Man, that was something. Really hard to find so concise and useful tutorial.
This is very clear tutorial about Gson library , thank you sir :)
You're welcome! :)
GoXR3Plus this is the best one I saw as compare to Parbesh, Buki tutorials.
:D
Bet json with java explanation in all internet. Thank you!
These tutorials have been a godsend. Thank you so much, Norman. Two thumbs up.
Thank you very much :)
Thank you for making this video series. They are very well made, simple to follow and have saved me a lot of time.
These Germans are good in making educational tutorials. Am a long time Sub of CodingInFlow and today I SUBSCRIBE TO YOURS TOO. KEEP UP AM LEARNING JSON
thanks and especially on vertically split screen way I did not know before
Great videos there Norman. I really appreciate.
You are most welcome
Thank you, I can understand that accent.
Thanks a lot. This one is the simplest one.
I am damn impressed, I want to do it with android, will search channel, your a good teacher
+Nick Jordan aka King of Spades ♠ thank you :)
Con el simple hecho de tener subtítulos te has acreditado mi suscripcion. Una genialidad tu forma de explicar.
Спасибо, дружище за объяснение!
Great videos. Could you please make a lecture on junit testing and espresso (not recorded) testing. I am learning from you and you video quality and way of teaching is the best. Honestly you are helping us this is very good moment for us. I don't have money to buy lectures and your lectures are the best one I saw on youtube.
Thank you to you and your team (if you have team) for spending your precious time on these videos.
#junit #espresso teseting please
Thanks for the compliment! Unfortunately, we don't have any plans to cover junit or espresso at the moment, sorry.
Great video . Thanks a lot Appreciate!
Thank you! you helped a lot on my test!
So simple. Amazing
More than excellent
Excellent video thanks sir!
Is there a way to auto-create this class in 1:50 given some sort of JSON?
Maybe I don't understand smth but what the point of json file if you initialize fields in java code. If some data will change in json file you still working with data in created object. I didn't notice the step of reading json data from the file. Could you pls explain how to do that? And thanks for the video
such a clear vedio....thank u sir........
excelent tutorial and video! Thanks !
Excellent!
Really Appreciated...bro great video...
I had to use GsonBuiler for the instantiation: Gson gson = new GsonBuilder()
.disableHtmlEscaping()
.serializeNulls()
.create();
cheers!
Great Video!! Thank you!
That's cool, but what if our json lie on some url. then what would we do?
This tutorial, is awesome cheers ✨✨✨.
Suppose you have several JSON files and model classes. Any tips on how I could make deserialization more generic in terms of the arguments that method "fromJson" takes in?
Thank you!!
how can i serialize a date attribute that come from a API(webservice) in microsoftFormat
Suppose I have a User Class which have Username(string) and password(string), but while converting this object to json via GSON , i want password to bet get encrypted(say MD5) .
Any Idea how to do that?
You could either encrypt the password when it gets set in the object (via a setter or the constructor), or you could try custom deserialization: futurestud.io/tutorials/gson-advanced-custom-deserialization-basics
PS: MD5 is not considered safe anymore, so it'd advise against using MD5.
Good tuto, thanks
why in the first example the name was the first thing you wrote in gson and in the second it was the last how does this works?
The order doesn't matter.
Great Video, Saved lot of my time : )
How did you format json in UserSimpleWithJson.json file?
Format code shortcut: th-cam.com/video/KRDJXKt4bTk/w-d-xo.html
Can you show List class object serialize and deserialize please.
amazing...thanks
Anyone know if its possible to get parameter hints/labels like in the video, but for Android Studio? They are very useful.
This is an IntelliJ feature. It's included in the Android Studio 3.0 builds!
Thanks for great videos !
Im a beginner with coding and have 2 questions:
1- Does the gsonClass (UserSimple) have to have same number of variables with json data ? What happens if UserSimple has 5 different variables and Json has 10 keys ? Can we fetch only 5 keys which we want from Json data ?
2- Does gsonClass(UserSimple) class have to have exactly same variable names with in Json's keys ? I mean, if our Json data has keys like :
Json data:
{
home_team: Real Madrid
away_team : Juventus
odd_1: 1.60
odd_x: 2,30
odd_2: 3,50
odd_u+2,5 : 1.80
odd_o+2,5 : 2.30
match_time : 18:30
match_date : 20-12-2017
}
I think it doesnt have to but if our class has to have same variable names with json data keys, I can not create a variable which has name like : "odd_u+2,5" in Java.
Thank you. Regarding your questions:
1) No, it does not have to be the same number. Gson will only convert the properties your UserSimple class describes. If the JSON has more properties, those will be ignored. In other words, if the JSON has 10 properties, but you only care about five of them, just add those to your Java model.
2) By default, the Java model property has to have the same name as the JSON. However, you can customize it with a simple annotation. The video for it is here: th-cam.com/video/qTXQGmYSazk/w-d-xo.html
they asked me this exact type of problem in netflix SDE interview, i have no clue what they are talking about. I wish i watched this tutorial before.
Hello and thanks for the nice video! Could i ask you something? If you got and JSON object with 100 attributes is it possible to convert it to a java object where i have only 3 attributes like title,id and date ? Can we somehow match those things ? Or do the Java object has to be exatly the same object like the JSON object ?
Thanks,
Alex
It's possible right? I'm very new with json and api handling and finding all this very overwhelming
how did u make your transparent background video?
With a green screen and chroma key: en.wikipedia.org/wiki/Chroma_key
Thanks realy helped me=)
#Excelent!
Hi ! I understood and really appreciate your video man :)
But I got an error when I did the same thing as you, I got :
"Could not find method compile() for arguments [com.google.gson:gson:2.8.0]"
But I have :
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
compile 'com.google.gson:gson:2.8.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
In my build.gradle
Does anyone have an idea please ?
Have a good day !
+Guillaume Cerdan it's not the correct line. It should be compile 'com.google.code.gson:gson:2.8.0'
Wusste es du bist Deutscher xD
Ze german accent is strong but it’s a good video (;
Thank you for ze comment :)
dependency for json doesn`t work
Gracias csmr gaaaaaa!!!!
alguien mas que hable espanol?JAJS me siento solo:(
No estás solo.
I now know your email. Mwahahaha !
Nao é isso que quero!
for what gson ?
to convert my server api json to gson ? and convert gsom to json object again ? lol
someone tell my why ?
why gson ?
for what ?