Skip to content

Instantly share code, notes, and snippets.

@jmcph4
Created January 30, 2024 01:40
Show Gist options
  • Select an option

  • Save jmcph4/4b90258fc6117b1b386b1eceae279adc to your computer and use it in GitHub Desktop.

Select an option

Save jmcph4/4b90258fc6117b1b386b1eceae279adc to your computer and use it in GitHub Desktop.
let top_val: serde_json::Value = serde_json::from_str(raw.as_ref())?;
let inner_val: &serde_json::Value = top_val
.get(
top_val
.as_object()
.unwrap()
.keys()
.collect::<Vec<_>>()
.first()
.unwrap(),
)
.unwrap();
let back_to_json: String = serde_json::to_string(inner_val)?;
Ok(serde_json::from_str(&back_to_json)?)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment