Skip to main content

json_or_string

Function json_or_string 

Source
pub fn json_or_string(text: String) -> Value
Expand description

Parses text as JSON, falling back to the string itself.

8080 is a number, true is a bool, foo is the string "foo" because it is not valid JSON, and [a,b] is the string "[a,b]" for the same reason.

Public because more than one caller needs this rule rather than a rule like it: --set’s RHS and ${env:VAR} in a whole-string position must type identically, and two matching implementations would only agree until one of them was edited.