diff --git a/src/afterfact.rs b/src/afterfact.rs index 3b469368e..4992ef9c8 100644 --- a/src/afterfact.rs +++ b/src/afterfact.rs @@ -1860,6 +1860,10 @@ pub fn output_json_str( )) && vec_data.is_empty() { + if matches!(profile, Profile::Details(_)) && val == "-" { + target.push(format!("{}\"{}\": {{}}", " ".repeat(4), key)); + continue; + } let tmp_val: Vec<&str> = val.split(": ").collect(); let output_val = _convert_valid_json_str(&tmp_val, matches!(profile, Profile::AllFieldInfo(_))); @@ -1907,7 +1911,7 @@ pub fn output_json_str( HashMap::new(); let mut children_output_order = vec![]; if detect_info.agg_result.is_some() { - if details_target_stock[0] == "-" { + if details_target_stock.is_empty() || details_target_stock[0] == "-" { output_stock.push(format!("{}\"{}\": {{}}", " ".repeat(4), key)); if jsonl_output_flag { target.push(output_stock.join(""));