-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
As a JSON Developer I can merge a JSON instance into another JSON instance to create a single instance
Acceptance Criteria
-
Definitions:
Primary: The JSON instance that will be used as the base instance for comparisonSecondary: The JSON instance the contains data to be pulled into theprimaryinstance.
-
JSONObject properties
- Where there are no conflicts between the
primaryandsecondaryinstances, i.e., , the data from thesecondaryinstance is pulled into theprimary - Where properties are equivalent, no additional action is needed
- Where there are conflicts between properties of the same name and context, there will be three different conflict strategies that can be applied
Accept Secondary: The value of thesecondaryinstance overrides theprimaryinstanceAccept Primary: The value of theprimaryinstance remainsAppend: Append the value of thesecondaryusing a new key (named[key name]_append)
- Where properties are not equivalent, then it will depend on the data type
- If the data types are the same (Primitive, Object, Array) then
- For primitive value types (e.g., Strings, Numbers, Boolean, Null), the selected conflict strategy will be applied
- For JSONObjects, the same merge rules will be applied recursively
- For JSONArrays, the JSONArray merging rules will be applied recursively
- If the data types are different, then the selected conflict strategy will be applied
- If the data types are the same (Primitive, Object, Array) then
- Where there are no conflicts between the
-
JSONArray items
- Items will be evaluated by index position
- The following Conflict Strategies can be applied to items
Insert Before: Insert the conflict item in thesecondaryarray into theprimaryjust before the item in the current positionInsert After: Insert the conflict item from thesecondaryarray into theprimaryjust after the item in the current positionAppend: Append the conflict item from thesecondaryarray to the end of theprimaryarray
- If both items at the same position are JSONObjects, then merging rules for JSONObjects are applied
- If both items at the same position are JSONArrays, the the arrays will be merged using the JSONArray merging rules
- If the items at the same position are a different data and value type then the selected Conflict Strategy will be applied.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request