17.1 Spring Boot| ObjectMapper | Converting JSON into Object using ObjectMapper

Поділитися
Вставка
  • Опубліковано 7 січ 2025

КОМЕНТАРІ • 25

  • @wicky3996
    @wicky3996 3 роки тому +4

    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🥰🥰🥰🥰

  • @abhishek2009fly
    @abhishek2009fly Рік тому

    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

  • @abhaykumar0215
    @abhaykumar0215 2 роки тому

    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

  • @kirwakelvinkering3122
    @kirwakelvinkering3122 Рік тому

    What of the case when the data is coming from the client ? How do you use @ResponseBody for nested Json data .

  • @viratsuresh5946
    @viratsuresh5946 2 роки тому

    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.

  • @nik08101986
    @nik08101986 4 роки тому +1

    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
      @fefo1717 3 роки тому

      Did you manage to find a tutorial explaining this? I'm kinda lost with that so any help would be really appreciated.

    • @krishanthbarkav4055
      @krishanthbarkav4055 3 роки тому

      @@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

    • @rajat_singla
      @rajat_singla 2 роки тому

      @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
      Use this on your date variable.

  • @mkulkarni8942
    @mkulkarni8942 Місяць тому

    Can we read jsonv2 using object mapper?

  • @vaibhavjain2315
    @vaibhavjain2315 4 роки тому +2

    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 !!

    • @PratikDandare
      @PratikDandare  4 роки тому +2

      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

    • @PratikDandare
      @PratikDandare  4 роки тому +1

      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

  • @RohitSingh-ko2cz
    @RohitSingh-ko2cz 3 роки тому

    i want to store json object to string format in database through spring boot api how?

  • @peterfernandes9011
    @peterfernandes9011 4 роки тому

    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

  • @lovepreetsingh7033
    @lovepreetsingh7033 4 роки тому +1

    use gson for serializing the deserializing the objects..

  • @gabrielfono844
    @gabrielfono844 2 роки тому

    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

  • @mukeshvishwakarma8441
    @mukeshvishwakarma8441 3 роки тому +1

    Loved it Bro.
    KeepItUP.

  • @devchawda9414
    @devchawda9414 2 роки тому +1

    Thanks for a clear video!! You can try to shorten it, otherwise its great

  • @ManikantaYedlapally
    @ManikantaYedlapally 4 роки тому +1

    Thank you brother

  • @AdityaKumar-cy2cr
    @AdityaKumar-cy2cr 3 роки тому

    👍

  • @srinivasponnam5114
    @srinivasponnam5114 4 роки тому

    Vedio is not clear