js_object!() {/* proc-macro */ }Expand description
Thejs_value! macro creates aJsValue instance based on a JSON-like DSL.
assert_eq!(js_value!(1), JsValue::from(1));assert_eq!(js_value!(false), JsValue::from(false));// Objects and arrays cannot be compared with simple equality.// To create arrays and objects, the context needs to be passed in.assert_eq!(js_value!([1,2,3], context).display().to_string(),"[ 1, 2, 3 ]");assert_eq!(js_value!({// Comments are allowed inside."key": (js_string!("value")) }, context).display().to_string(),"{\n key: \"value\"\n}",);Create aJsObject object from a simpler DSL that resembles JSON.