mirror of
https://github.com/nushell/nushell.git
synced 2025-08-18 20:58:41 +02:00
to json -r
not removing whitespaces fix (#11948)
fixes #11900 # Description Use `serde_json` instead. # User-Facing Changes The problem described in the issue now no longer persists. No whitespace in the output of `to json --raw` Output of unicode escape changed to consistent `\uffff` # Tests + Formatting I corrected all Tests that were affected by this change.
This commit is contained in:
@@ -1032,8 +1032,9 @@ pub fn to_string_raw<T>(value: &T) -> Result<String>
|
||||
where
|
||||
T: ser::Serialize,
|
||||
{
|
||||
let vec = to_vec(value)?;
|
||||
let string = String::from_utf8(vec)?;
|
||||
let output = string.lines().map(str::trim).collect();
|
||||
Ok(output)
|
||||
let result = serde_json::to_string(value);
|
||||
match result {
|
||||
Ok(result_string) => Ok(result_string),
|
||||
Err(error) => Err(Error::Io(std::io::Error::from(error))),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user