Class JSONMerger

java.lang.Object
software.bluelib.json.JSONMerger

public class JSONMerger extends Object
A public class responsible for merging JSON data from a source JsonObject into a target JsonObject.

This class provides functionality to combine JSON data where overlapping keys result in merging arrays, and non-overlapping keys are simply added to the target.

Key Methods:

Since:
1.0.0
  • Constructor Details

    • JSONMerger

      public JSONMerger()
  • Method Details

    • mergeJsonObjects

      public void mergeJsonObjects(com.google.gson.JsonObject pTarget, com.google.gson.JsonObject pSource)
      A public void method that merges data from a source JsonObject into a target JsonObject.

      If the target JSON object already contains a key present in the source JSON object, the values are merged if they are arrays. Otherwise, the source value is added to the target JSON object.

      Parameters:
      pTarget - JsonObject - The target JsonObject to merge data into. This object will be modified by adding or updating its values.
      pSource - JsonObject - The source JsonObject to merge data from. This object is not modified by the operation.
      Since:
      1.0.0