Skip to content

Add Object type alias for JSON objects #1269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CryZe
Copy link
Contributor

@CryZe CryZe commented Jul 8, 2025

This PR adds a convenient Object type alias to eliminate the need for repeatedly writing Map<String, Value> when working with JSON objects.

Instead of:

use serde_json::{Map, Value};
let obj: Map<String, Value> = serde_json::from_str(json_str)?;

Users can now write:

use serde_json::Object;
let obj: Object = serde_json::from_str(json_str)?;

Fixes #776

This PR adds a convenient `Object` type alias to eliminate the need for
repeatedly writing `Map<String, Value>` when working with JSON objects.

Instead of:
```rust
let obj: Map<String, Value> = serde_json::from_str(json_str)?;
```

Users can now write:
```rust
use serde_json::Object;
let obj: Object = serde_json::from_str(json_str)?;
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Provide an Object type alias
1 participant