how to use JPA repository to fetch such object ... I am getting exception as -> cannot deserialize instance of java.lang.string out of start_object token
Just one question that if I am passing the hobbies json name as "HOBBIES" and rest the same I am getting the exception of unrecognized filed ,not marked as ignorable and while checking it I found that internally hibernate is changing the name of the HOBBIES to hobbies even if I am trying to create the name as private HOBBIES HOBBIES; and this is the reason why I m getting that error and if I am keeping passing my json object as hobbies:{} then it working fine but HOBBIES :{} is not working
What happens when input json contains date value in some format or it contains some flag as yes or no instead of true false... How would it can be handled?
@@fefo1717 DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); ObjectMapper objectMapper = new ObjectMapper(); objectMapper.setDateFormat(df); this should answer ur question
Great video, but please answer my question. I use mongodb with sprinboot. I never use obejectmapper their. I create my class as per JSON fields. Somehow, JSON is directly mapped to object. I don't know how this happen or this happen with mongodb only. Please share you thought and share some link to read more about it. Cheers !!
Suppose take example of controller you send json and somehow it convert into entity Behind sean Jackson works for you. You use mongo db internally repository communicate with with mongo but when you create repository you need to add class name and primary key that's way it convert Data come from mongo into required entity. I added this video because of some time you hit third party api and it give you json as string or take another scenario you store some json responce in MySQL to convert that string json into entity we use ObjectMapper, Because working on json is tough than working of entity
I have another scenario if you build multipart request and at same time you want input so at that time you need send string json and after that you need to convert it into entity, So, according secnario you need to use it
I`m having an error in spring security java.lang.RuntimeException: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'email': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false') at [Source: (org.apache.catalina.connector.CoyoteInputStream); line: 1, column: 7] at com.fernandes.bethel.jwt.JwtEmailAndPasswordAuthenticationFilter.attemptAuthentication(JwtEmailAndPasswordAuthenticationFilter.java:50) It works with postman, but not with browser do u have any idea y
You beauty. Two days i got stucked in this concept. And I found your video.Thank you for saving my job! It means a lot🥰🥰🥰🥰
how to use JPA repository to fetch such object ... I am getting exception as -> cannot deserialize instance of java.lang.string out of start_object token
Just one question that if I am passing the hobbies json name as "HOBBIES" and rest the same I am getting the exception of unrecognized filed ,not marked as ignorable and while checking it I found that internally hibernate is changing the name of the HOBBIES to hobbies even if I am trying to create the name as private HOBBIES HOBBIES; and this is the reason why I m getting that error and if I am keeping passing my json object as hobbies:{} then it working fine but HOBBIES :{} is not working
What of the case when the data is coming from the client ? How do you use @ResponseBody for nested Json data .
Json string to java object conversion. But my java object has map in it along with other variables.
Map
In that case how we can achieve it.
What happens when input json contains date value in some format or it contains some flag as yes or no instead of true false... How would it can be handled?
Did you manage to find a tutorial explaining this? I'm kinda lost with that so any help would be really appreciated.
@@fefo1717 DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.setDateFormat(df);
this should answer ur question
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
Use this on your date variable.
Can we read jsonv2 using object mapper?
Great video, but please answer my question. I use mongodb with sprinboot. I never use obejectmapper their. I create my class as per JSON fields. Somehow, JSON is directly mapped to object. I don't know how this happen or this happen with mongodb only.
Please share you thought and share some link to read more about it.
Cheers !!
Suppose take example of controller you send json and somehow it convert into entity
Behind sean Jackson works for you. You use mongo db internally repository communicate with with mongo but when you create repository you need to add class name and primary key that's way it convert Data come from mongo into required entity.
I added this video because of some time you hit third party api and it give you json as string or take another scenario you store some json responce in MySQL to convert that string json into entity we use ObjectMapper, Because working on json is tough than working of entity
I have another scenario if you build multipart request and at same time you want input so at that time you need send string json and after that you need to convert it into entity,
So, according secnario you need to use it
i want to store json object to string format in database through spring boot api how?
I`m having an error in spring security
java.lang.RuntimeException: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'email': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
at [Source: (org.apache.catalina.connector.CoyoteInputStream); line: 1, column: 7]
at com.fernandes.bethel.jwt.JwtEmailAndPasswordAuthenticationFilter.attemptAuthentication(JwtEmailAndPasswordAuthenticationFilter.java:50)
It works with postman, but not with browser
do u have any idea y
use gson for serializing the deserializing the objects..
I will do that
sir
why we use objectMapping
what is the point of it
I am new in java and it is my first job and i am really confused
Loved it Bro.
KeepItUP.
Thanks for a clear video!! You can try to shorten it, otherwise its great
Thank you brother
😇
👍
Vedio is not clear