Package software.bluelib.json
Class JSONMerger
java.lang.Object
software.bluelib.json.JSONMerger
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:
mergeJsonObjects(JsonObject, JsonObject)- Merges the data from the source JSON object into the target JSON object.
- Since:
- 1.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidmergeJsonObjects(com.google.gson.JsonObject pTarget, com.google.gson.JsonObject pSource) Apublic voidmethod that merges data from a sourceJsonObjectinto a targetJsonObject.
-
Constructor Details
-
JSONMerger
public JSONMerger()
-
-
Method Details
-
mergeJsonObjects
public void mergeJsonObjects(com.google.gson.JsonObject pTarget, com.google.gson.JsonObject pSource) Apublic voidmethod that merges data from a sourceJsonObjectinto a targetJsonObject.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 targetJsonObjectto merge data into. This object will be modified by adding or updating its values.pSource-JsonObject- The sourceJsonObjectto merge data from. This object is not modified by the operation.- Since:
- 1.0.0
-