Function json2lua::parse

source ·
pub fn parse(json: &str) -> Result<String>
Expand description

Parse JSON string into a Lua table

use json2lua::parse;

let json = r#"{
	"string": "abc",
	"int": 123,
	"bool": true,
	"null": null
}"#;

let lua = r#"{
	["string"] = "abc",
	["int"] = 123,
	["bool"] = true,
	["null"] = nil,
}"#;

assert_eq!(parse(json).unwrap(), lua);