Skip to content

Document how to customize JSON decoding via DecoderFactory - #10897

Open
alamb wants to merge 1 commit into
apache:mainfrom
alamb:document-json-decoder-factory
Open

Document how to customize JSON decoding via DecoderFactory#10897
alamb wants to merge 1 commit into
apache:mainfrom
alamb:document-json-decoder-factory

Conversation

@alamb

@alamb alamb commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

N/A -- documentation only.

Rationale for this change

  • Json decoder factory #10670 adds the ability to customize JSON decoding via DecoderFactory, but the docs don't mention it, so users would only find the hook by stumbling on ReaderBuilder::with_decoder_factory.

What changes are included in this PR?

This adds the matching pointers for decoding that #10741 added for encoding, as anticipated in that PR's description.

I also cleaned up some other docs while I was reviewing the original PR

Are these changes tested?

Covered by existing doc tests and CI rustdoc link checking.

Are there any user-facing changes?

Documentation only.

@github-actions github-actions Bot added arrow Changes to the arrow crate arrow-json labels Aug 27, 2026
@alamb
alamb force-pushed the document-json-decoder-factory branch from aaeff15 to 5e28394 Compare September 2, 2026 11:20
@alamb alamb mentioned this pull request Sep 2, 2026
//!
//! The lower-level [`Decoder`] can be integrated with various forms of async data streams,
//! and is designed to be agnostic to the various different kinds of async IO primitives found
//! The lower-level [`Decoder`] can be integrated with various forms of async

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive by to make the text clearer

//! }
//! ```
//!
//! # Customizing the decoder

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main purpose of this PR: leave a note here about how to customize the decoder

/// implementation with [`ReaderBuilder::with_decoder_factory`].
///
/// # Examples
/// # Example: Decode `Binary` from a JSON array of integers

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example originally showed how to use the decoder factory as well as switch on the extension type. I think it would be clearer to have separate examples, so I split it into two examples and added some comments

/// [`WriterBuilder::with_encoder_factory`]: crate::writer::WriterBuilder::with_encoder_factory
///
/// # Examples
/// # Example: Encode a `BinaryArray` as an array of integers

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to make the examples here a little clearer and added some more explanatory docs

Comment thread arrow-json/src/lib.rs
//! writing / after reading, as shown in the following example.
//!
//! [Customizing the encoder]: writer#customizing-the-encoder
//! [Customizing the decoder]: reader#customizing-the-decoder

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is the main entry to help people find the new feature

Adds crate-level and reader-module doc pointers to the `DecoderFactory`
extension point added in apache#10670, mirroring the encoder documentation
added in apache#10741.
@alamb
alamb force-pushed the document-json-decoder-factory branch from 5e28394 to ff1278a Compare September 2, 2026 11:26
@alamb
alamb marked this pull request as ready for review September 2, 2026 11:37

@Rich-T-kid Rich-T-kid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not super familiar with the json crate, but the documentation seems clear & concise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate arrow-json

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants