summaryrefslogtreecommitdiffstats
path: root/src/file/format/json.rs
diff options
context:
space:
mode:
authorDavid Orchard <if_coding@fastmail.com>2021-08-01 00:03:10 -0700
committerDavid Orchard <if_coding@fastmail.com>2021-08-15 10:31:58 -0700
commitcc0530a7716779f954b1756905a9f4ceb7eb6d62 (patch)
tree311b2ca44a282bbc629a08123f53a855cba38c1c /src/file/format/json.rs
parent622efaca17256fb42dafc61c8df1f3037c1fb772 (diff)
Move order preservation under a feature gate
Diffstat (limited to 'src/file/format/json.rs')
-rw-r--r--src/file/format/json.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/file/format/json.rs b/src/file/format/json.rs
index a6a9443..c4895fb 100644
--- a/src/file/format/json.rs
+++ b/src/file/format/json.rs
@@ -1,19 +1,19 @@
-use linked_hash_map::LinkedHashMap;
use std::error::Error;
+use crate::map::MapImpl;
use crate::value::{Value, ValueKind};
pub fn parse(
uri: Option<&String>,
text: &str,
-) -> Result<LinkedHashMap<String, Value>, Box<dyn Error + Send + Sync>> {
+) -> Result<MapImpl<String, Value>, Box<dyn Error + Send + Sync>> {
// Parse a JSON object value from the text
// TODO: Have a proper error fire if the root of a file is ever not a Table
let value = from_json_value(uri, &serde_json::from_str(text)?);
match value.kind {
ValueKind::Table(map) => Ok(map),
- _ => Ok(LinkedHashMap::new()),
+ _ => Ok(MapImpl::new()),
}
}
@@ -34,7 +34,7 @@ fn from_json_value(uri: Option<&String>, value: &serde_json::Value) -> Value {
serde_json::Value::Bool(value) => Value::new(uri, ValueKind::Boolean(value)),
serde_json::Value::Object(ref table) => {
- let mut m = LinkedHashMap::new();
+ let mut m = MapImpl::new();
for (key, value) in table {
m.insert(key.clone(), from_json_value(uri, value));