Skip to content

Write the OME-Zarr metadata with System.Text.Json - #9

Merged
IOL0ol1 merged 2 commits into
masterfrom
refactor/system-text-json
Nov 19, 2026
Merged

IOL0ol1 merged 2 commits into
masterfrom
refactor/system-text-json

Conversation

@IOL0ol1

@IOL0ol1 IOL0ol1 commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Replaces the core package's hand-written JSON writer with System.Text.Json.Utf8JsonWriter (compact, relaxed escaping since the documents are served as JSON files).

  • net10.0 uses the in-box System.Text.Json; the netstandard2.0 and netstandard2.1 targets now depend on the System.Text.Json 10.0.15 package. Test-Packages asserts the new dependency groups.
  • The metadata documents parse to the same values as before. Byte-for-byte, numbers are unchanged on .NET 10; names with characters such as emoji, control characters or U+2028 are now written as \uXXXX escapes.
  • The package smoke test now reads zarr.json, so the .NET Framework smoke builds load System.Text.Json.

Replace the hand-written JsonText writer with Utf8JsonWriter. The documents
keep their members and order, and the relaxed encoder leaves characters such
as < > & ' + and most non-ASCII text unescaped, as before. Some characters in
the image name are now written as \u escapes: those outside the BMP, DEL and
C1 controls, and format, separator, private-use and unassigned code points;
\u escapes now use upper-case hex digits.

On .NET 10 numbers are written as before. On .NET Framework, System.Text.Json
writes non-integers with 17 significant digits (0.242 as 0.24199999999999999),
which parse to the same values.

The netstandard2.0 and netstandard2.1 builds now depend on the
System.Text.Json package; net10.0 uses the shared framework's copy.
The .NET Framework smoke apps load the netstandard2.0 core with the
System.Text.Json package, so a dependency that fails to load now fails them.
@IOL0ol1
IOL0ol1 merged commit 97db750 into master Nov 19, 2026
12 checks passed
@IOL0ol1
IOL0ol1 deleted the refactor/system-text-json branch November 19, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant