try_json_stringify

Function try_json_stringify 

Source
pub fn try_json_stringify(obj: &Value, fallback: &str) -> String
Expand description

Try to stringify an object to JSON.

§Arguments

  • obj - The object to stringify.
  • fallback - The fallback string to return if stringification fails.

§Returns

A JSON string if successful, otherwise the fallback string.