I am trying to store response from reqwest to a struct but if the struct is missing few identifiers I am getting an error.
let response = client.get(dataset_path.as_str()).send()?;
let dataset_details = response.json::()?;
the response doesn't have 'name' field which is present in the Struct Dataset.
Is there a way to ignore identifiers in the struct if the values are not present in the response?
Have you considered using Option<Name>? Initialize with None when the value is missing.
Try using Option, or add #[serde(default)] to your name field if you want a default value if not present.
Thanks for your response. I tried with the first option given by and it worked @EdmundsEcho ![]()
Thank you for your help. It worked:)