[][src]Function tracery::from_json

pub fn from_json<S: AsRef<str>>(s: S) -> Result<Grammar>

Creates a new grammar from a JSON grammar string

Examples

let json = r##"{
    "origin": [ "#tool# is #description#!" ],
    "tool": [ "tracery" ],
    "description": [ "fun", "awesome" ]
}"##;
let g = tracery::from_json(json)?;