Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7717939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:02:05+00:00 2026-06-01T03:02:05+00:00

Is it possible to merge two JSON documents with the Jackson JSON library? I

  • 0

Is it possible to merge two JSON documents with the Jackson JSON library? I am basically using the Jackson mapper with simple Java Maps.

I’ve tried to search in Google and Jackson’s documentation but couldn’t find anything.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T03:02:08+00:00Added an answer on June 1, 2026 at 3:02 am

    One way is to use ObjectReader like so:

    MyBean defaults = objectMapper.readValue(defaultJson, MyBean.class);
    ObjectReader updater = objectMapper.readerForUpdating(defaults);
    MyBean merged = updater.readValue(overridesJson);
    

    which will combine data from two sources. This only makes a shallow copy, i.e. does not do recursive merge on contained objects.

    Otherwise you may need to just read JSON as a tree (JsonNode), loop over contents and merge manually. This often makes sense anyway since rules of merging are not trivial, and everyone has their own ideas of how merging should work.

    EDIT: (03-Apr-2017)

    As per @Fernando Correia’s comment, there is actually a new feature added in upcoming Jackson 2.9 (to be released in April or May 2017) that does allow deep merging, finally.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: What is the best method to merge two PHP objects? I have
I'm using git-tfs , and I was wondering if it is possible to merge
I'm trying to merge two branches together using mercurial and there are some conflicts.
hello is it possible to merge / combine / pack two .exe files example
Possible Duplicate: How to merge two images into a single Jpeg I have 2
Possible Duplicates: Merging two sorted lists Algorithm for N-way merge Given k sorted arrays
Does anyone know if it's possible to merge two lists (or any collection) in
Is it possible to merge two apps, one e-commerce application based on PrestaShop with
Possible Duplicate: Merge 2 Arrays and Sum the Values (Numeric Keys) I have two
What are the possible methods to merge values from two mutually exclusive DataSets' into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.