@@ -20,6 +20,7 @@ use web_sys::{Blob, BlobPropertyBag, Url};
2020use wasm_bindgen:: JsValue ;
2121use js_sys:: Array ;
2222use web_sys:: wasm_bindgen:: JsCast ;
23+ use serde_json:: Value ; // Import Value from serde_json
2324
2425
2526#[ derive( Debug , Serialize , Deserialize ) ]
@@ -195,12 +196,24 @@ async fn download_xs_cache(selected_indexes: HashSet<usize>) {
195196 // Convert the cache data to a pretty-printed JSON string
196197 let json_data = serde_json:: to_string_pretty ( & cache) . unwrap ( ) ;
197198
199+ // Deserialize the JSON string into a serde_json::Value
200+ let mut json_value: Value = serde_json:: from_str ( & json_data) . unwrap ( ) ;
201+
202+ // Remove the "checkbox_selected" key
203+ if let Value :: Object ( ref mut map) = json_value {
204+ map. remove ( "checkbox_selected" ) ;
205+ }
206+
207+ // Serialize the modified JSON value back to a string
208+ let modified_json_data = serde_json:: to_string_pretty ( & json_value) . unwrap ( ) ;
209+
210+
198211 // Create a Blob from the JSON data
199212 let blob_options = BlobPropertyBag :: new ( ) ;
200213 blob_options. set_type ( "application/json" ) ;
201214
202215 let blob = Blob :: new_with_str_sequence_and_options (
203- & Array :: of1 ( & JsValue :: from_str ( & json_data ) ) ,
216+ & Array :: of1 ( & JsValue :: from_str ( & modified_json_data ) ) ,
204217 & blob_options,
205218 ) . unwrap ( ) ;
206219
@@ -546,10 +559,10 @@ pub fn home() -> Html {
546559 </button>
547560
548561 <button
549- class="btn btn-primary mt -2"
562+ class="btn btn-primary me -2"
550563 onclick={ onclick_download}
551564 >
552- <i class="fas fa-download mr -2" ></i>
565+ <i class="fas fa-download me -2" ></i>
553566 { " Download Cross Section Data" }
554567 </button>
555568
0 commit comments