pub fn parse_object(s: &str) -> Result<JsonValue, Error<'_>>
Expand description
Parse a JsonValue::Object
from an input string.
use jsnom::{parse_object, JsonValue::{self, *}};
assert_eq!(
parse_object("{\"user\": \"Piturnah\", \"crates\": [\"gex\", \"newdoku\", \"jsnom\"]}"),
Ok(JsonValue::Object(vec![
(String("user".to_string()), String("Piturnah".to_string())),
(String("crates".to_string()), Array(vec![
String("gex".to_string()),
String("newdoku".to_string()),
String("jsnom".to_string()),
]))
])));