Skip to content

Commit

Permalink
Fix unescape
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-uk1 committed Jan 9, 2019
1 parent 8e732f2 commit c29b7cd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,10 +538,11 @@ impl fmt::Debug for JsValue {
return fmt::Display::fmt("Symbol(..)", f);
}
let json = self.as_json();
if json == "{}" {
let json_unescape = (&json[1..json.len()-1]).replace("\\\"", "\"");
if json_unescape == "{}" {
f.write_str("[object]")
} else {
f.write_str(&json)
f.write_str(&json_unescape)
}
}
}
Expand Down

0 comments on commit c29b7cd

Please sign in to comment.