From 6607e994628a9920ea5750d00f092ca8cac75f3c Mon Sep 17 00:00:00 2001 From: Kudlaty Date: Mon, 9 Aug 2021 14:23:03 +0200 Subject: [PATCH] fix: omit duplicates in array when merging --- src/process/merge_allof.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/process/merge_allof.rs b/src/process/merge_allof.rs index 25a591c..825eeb8 100644 --- a/src/process/merge_allof.rs +++ b/src/process/merge_allof.rs @@ -143,7 +143,9 @@ fn merge_values(a: &mut Value, b: Value, options: &MergerOptions) { (a @ &mut Value::Array(_), Value::Array(b)) => { let a = a.as_array_mut().unwrap(); for v in b { - a.push(v); + if !a.contains(&v) { + a.push(v); + } } } (a, b) => *a = b,