Skip to content

Conversation

nhz2
Copy link
Member

@nhz2 nhz2 commented Oct 3, 2025

This PR adds a JSON.writefile function with the same functionality and keyword arguments as the new JSON.json function. This function is provided for backward compatibility when upgrading from
older versions of JSON.jl where the json function signature differed.

The idea is that JSON.writefile will be backported to v0.21.5

Copy link

codecov bot commented Oct 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.00%. Comparing base (d9288fb) to head (3f0bd4d).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #381      +/-   ##
==========================================
+ Coverage   89.89%   90.00%   +0.10%     
==========================================
  Files           7        7              
  Lines        1316     1330      +14     
==========================================
+ Hits         1183     1197      +14     
  Misses        133      133              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

"""
function writefile end

function writefile(::Type{Vector{UInt8}}, x; pretty::Union{Integer,Bool}=false, kw...)
Copy link
Member

Choose a reason for hiding this comment

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

I'm not following why we want this or the 2nd definitions? writefile that doesn't write to a file and just returns a byte vector?

Copy link
Member Author

Choose a reason for hiding this comment

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

I want to avoid extra conversions between String and Vector{UInt8} for use with Zarr.jl and SmallZarrGroups.jl

I'm also trying to match the style of the writefile function in Parquet2.jl https://expandingman.gitlab.io/Parquet2.jl/#Writing-Data

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.

2 participants