serde-rs / serde-rs/json

Generalize JSON macro to any serializer

Open
#239 15 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
5.6k
Forks
670
PR merge metrics
No merged PRs in 30d

Description

I really like json! macro but would want to use it even with other serializers or at least for streaming serialization of JSON structure (not constructing entire Value tree in-memory and then flushing altogether).

It looks like it should be possible to add intermediate macro that would accept $serializer:ident and use it with serialize_map / serialize_seq instead of creating values, and then json! macro would be just a wrapper that calls intermediate one with internal Serializer just like to_value currently does, but I've noticed the comment about breaking changes and wondered if this is something that can be considered or should be done outside of this project.

cc @SergioBenitez

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing json! macro and the to_value entry point, then examine how serialize_map and serialize_seq relate to the proposed serializer input. Done would require a settled API direction for generalized or streaming serialization, followed by implementation and validation; the issue names no files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.