Repository navigation
feat!: JSON format on JSON.jl v1 instead of the deprecated JSON3.jl (JSONTag) - #468
Merged
Merged
Conversation
- weak dependency JSON (extension CTModelsJSON), JSON3Tag renamed JSONTag - the extension reads with JSON.parse into plain Dicts and writes with JSON.json; an export serializes first, so a NaN leaves no half-written file - the format of the files is unchanged; test_json_format.jl reads files written by the JSON3-based version (fixtures) and checks the keys and shapes of a file written now - BREAKING.md with a migration block, CHANGELOG, docs Closes #467 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ocots
marked this pull request as ready for review
October 18, 2026 18:53
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #467.
Stacked on #463 (switching structure): both edit
ext/CTModelsJSON.jl, so the base of this PR isfeat/switching-structure. Once #463 is merged, the base moves tomain.What changes
JSON3.jl is deprecated in favour of JSON.jl v1. The JSON format of a
Solutionnow uses it.JSON3→JSON(weak dependency, test dependency,[compat], docs environment). The extension keeps its name,CTModelsJSON, which now matches its trigger.JSON3.read(s)→JSON.parse(s; dicttype=Dict{String,Any}): plain dictionaries, read withblob["key"];_to_plainis no longer needed.JSON3.pretty→JSON.json(...; pretty=true).NaN, as before) leaves no half-written file.JSON3Tag→JSONTag, and the stubs raiseExtensionError(:JSON; ...). This is a breaking change, accepted in favour of clean naming.format=:JSONis unchanged;BREAKING.mdhas the migration block.Tests
test/suite/serialization/test_json_format.jl:test/fixtures/json3_*.json, exported with CTModels 0.19.8: one plain solution and one with duals);format_versiondiffers, as announced in feat(Solutions): switching structure of a solution; strict time grids #463);NaNrejected with no file left,JSONTagreplacesJSON3Tag.JSON3.read/write→JSON.parse/json,JSONTag).@extrefto theCTBase.Plottingbuilding blocks of #613 (not released yet), already there in feat(Solutions): switching structure of a solution; strict time grids #463.Not in this PR
Solutionwith unset optional fields (NotProvided) fails in both formats: Export/import round trip fails for a Solution with unset optional solver fields (NotProvided) #464. It is independent of the choice of the JSON package.using JSON3,docs/Project.toml,docs/make.jl): to update once this is released; issue to open there.🤖 Generated with Claude Code