Repository: serde-rs/json (language: rust)

Issue:
impl From<Number> for Value is missing
This could be useful at times. The concrete use case I have is a string that needs to be converted to `Value`. The string could be either numerical in which case it should be `Value::Number` or just a text, in which case it will be `Value::String`.
So I am using next code:
```rust
// text here is &str
if let Ok(number) = text.parse::<Number>() {
    Value::Number(number)
} else {
    Value::from(text)
}
```

Writing `Value::from(number)` feels cleaner



Discussion / hints:

Fix patch:
diff --git a/src/value/from.rs b/src/value/from.rs
index 4423a02fb..2fe8037bb 100644
--- a/src/value/from.rs
+++ b/src/value/from.rs
@@ -136,6 +136,22 @@ impl<'a> From<Cow<'a, str>> for Value {
     }
 }
 
+impl From<Number> for Value {
+    /// Convert `Number` to `Value`
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use serde_json::{Number, Value};
+    ///
+    /// let n = Number::from(7);
+    /// let x: Value = n.into();
+    /// ```
+    fn from(f: Number) -> Self {
+        Value::Number(f)
+    }
+}
+
 impl From<Map<String, Value>> for Value {
     /// Convert map (with string keys) to `Value`
     ///


Test patch: