From befb7d19d10ac7bd655bb0275183d35962019ef7 Mon Sep 17 00:00:00 2001 From: Christopher Serr Date: Tue, 8 Jul 2025 18:21:28 +0200 Subject: [PATCH] Add `Object` type alias for JSON objects This PR adds a convenient `Object` type alias to eliminate the need for repeatedly writing `Map` when working with JSON objects. Instead of: ```rust let obj: Map = serde_json::from_str(json_str)?; ``` Users can now write: ```rust use serde_json::Object; let obj: Object = serde_json::from_str(json_str)?; ``` --- src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 5f066de26..23cc0b338 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -402,6 +402,9 @@ pub use crate::ser::{to_writer, to_writer_pretty, Serializer}; #[doc(inline)] pub use crate::value::{from_value, to_value, Map, Number, Value}; +/// Represents a JSON object. +pub type Object = Map; + // We only use our own error type; no need for From conversions provided by the // standard library's try! macro. This reduces lines of LLVM IR by 4%. macro_rules! tri {