Skip to content

Commit

Permalink
a few fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rscarson committed Oct 23, 2023
1 parent 8b2a10d commit 4dea155
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,19 +327,19 @@ impl Value {
matches!(self, Value::None)
}

// Attempt to convert the value from JSON
/// Attempt to convert the value from JSON
pub fn from_json(value: serde_json::Value) -> Option<Self> {
if let Ok(v) = serde_json::from_value::<FloatType>(value) {
if let Ok(v) = serde_json::from_value::<FloatType>(value.clone()) {
Some(v.into())
} else if let Ok(v) = serde_json::from_value::<IntegerType>(value) {
} else if let Ok(v) = serde_json::from_value::<IntegerType>(value.clone()) {
Some(v.into())
} else if let Ok(v) = serde_json::from_value::<bool>(value) {
} else if let Ok(v) = serde_json::from_value::<bool>(value.clone()) {
Some(v.into())
} else if let Ok(v) = serde_json::from_value::<&str>(value) {
} else if let Ok(v) = serde_json::from_value::<String>(value.clone()) {
Some(v.into())
} else if let Ok(v) = serde_json::from_value::<ArrayType>(value) {
} else if let Ok(v) = serde_json::from_value::<ArrayType>(value.clone()) {
Some(v.into())
} else if let Ok(v) = serde_json::from_value::<ObjectType>(value) {
} else if let Ok(v) = serde_json::from_value::<ObjectType>(value.clone()) {
Some(v.into())
} else {
None
Expand Down

0 comments on commit 4dea155

Please sign in to comment.