gjson.rs icon indicating copy to clipboard operation
gjson.rs copied to clipboard

Creating new instances of Value

Open clarkmcc opened this issue 1 year ago • 0 comments

I'd like to create new instances of each type of value. Specifically, I'm using gjson to read settings from a JSON object, but I need a fucntion that produces a default value for the setting for each accessible key. I'd like to be able to do things like this

let str = Value::String("Foobar");
let num = Value::Number(10);
let ok = Value::Bool(true);
let nothing = Value::Null;

Is this possible?

clarkmcc avatar Mar 29 '23 14:03 clarkmcc