We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent adf87dd commit 4a47e07Copy full SHA for 4a47e07
src/utils/json/mod.rs
@@ -18,6 +18,7 @@
18
19
use std::num::NonZeroU32;
20
21
+use flatten::{convert_to_array, generic_flattening};
22
use serde_json;
23
use serde_json::Value;
24
@@ -37,9 +38,11 @@ pub fn flatten_json_body(
37
38
validation_required: bool,
39
) -> Result<Value, anyhow::Error> {
40
let mut nested_value = if schema_version == SchemaVersion::V1 {
- flatten::generic_flattening(&body)
41
- .map(flatten::convert_to_array)
42
- .unwrap_or(Ok(body))?
+ if let Ok(flattened_json) = generic_flattening(&body) {
+ convert_to_array(flattened_json)?
43
+ } else {
44
+ body
45
+ }
46
} else {
47
body
48
};
0 commit comments