How to read JSON file in Java? ( Jackson Databind )

Поділитися
Вставка
  • Опубліковано 15 жов 2024

КОМЕНТАРІ • 24

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

    Wow this is exactly what I was looking for. Thank you!!

  • @arun7232
    @arun7232 Рік тому +1

    such a good content noone explains like you about jackson databind.thanks for teaching us .keep uploading good content

  • @pritamsharma9957
    @pritamsharma9957 Рік тому +1

    Thanks a lot, short but clear description, very helpful.

  • @alekBold
    @alekBold 5 місяців тому +1

    Very usefull, thank you

  • @bhawanagupta1371
    @bhawanagupta1371 Рік тому +1

    Thanks for the tutorial but want to know how we will update tha version of the package jackson- databind from a old version to current version ???

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

      You need to update the pom.xml with latest version of jackson-databind and rebuild the project. you can find latest version on - mvnrepository.com/. Thank you.
      com.fasterxml.jackson.core
      jackson-databind
      2.14.2

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

    Very good guide. Thank you so much

  • @stefanodiluzio67
    @stefanodiluzio67 Рік тому +1

    How is it performance wise with 2+Gb JSON files? Are there any other solutions to read and process the json file in chunks?

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

      Both Jackson and Gson have streaming implementations which can be used I believe. I need to check further and see if I can implement the same with streaming.

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

      @@TechRecipesTR That would be awesome to see, thanks :)

  • @asadhussain5715
    @asadhussain5715 Рік тому +1

    finally a worthy video

  • @TusharBirole
    @TusharBirole Рік тому +1

    Thanks a lot.

  • @olaroslik4413
    @olaroslik4413 2 роки тому +2

    Thank you!

  • @sravandatha9511
    @sravandatha9511 10 місяців тому

    Will it work even after deployment

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

    Is this supported on newer spring boot versions? I had some errors recently

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

      Yes. It must be supported. Do you remember what errors you faced ?

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

    How can I do if get the file and data (single string) from UI side like
    Controller.java
    Public Book uploadJson(@RequestPart("data") String data, @RequestPart("file") List file){
    Book response = jsonDataService.uploadJson(data,file);
    return response;
    jsonDataService.class
    public book uploadJson(String data, List file{
    ObjectMapper objectMapper = new ObjectMapper();
    List response = ObjectMapper.readValue(file, new TypeReference(){});
    Return response;
    }
    If the file is not in the resourses, How to read the file and data if get from UI side and send the response ?

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

      Looking at your code. I see that you are getting List you can iterate to get individual MultipartFile and then use MultipartFile.getInpitStream() to read the file content coming from UI.

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

      @@TechRecipesTR I have tried that I am getting File upload failed, where my file is nested Json file.

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

      You should not upload it again as code is executing on the server itself. You can simply read the file using InputStreaam and use FileWriter to write it on disc.
      Hope this helps!

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

      @@TechRecipesTR Thank you so much

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

    instead of objectmapper you said bloomberg like that, what it is

    • @TechRecipesTR
      @TechRecipesTR  Рік тому +2

      Project Lombok projectlombok.org/
      It will reduce boilerplate code like a getter setter constructor. We can simply use annotations instead.