Skip to content

Jd/drop json3#1666

Merged
jd-lara merged 3 commits into
psy6from
jd/drop_json3
Apr 27, 2026
Merged

Jd/drop json3#1666
jd-lara merged 3 commits into
psy6from
jd/drop_json3

Conversation

@jd-lara
Copy link
Copy Markdown
Member

@jd-lara jd-lara commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR removes the JSON3 dependency and migrates JSON parsing/printing across the codebase, tests, and docs to use JSON.jl as a companion change to InfrastructureSystems.jl PR #571.

Changes:

  • Replace JSON3.read(...) usage with JSON.parse(...; dicttype = Dict{String, Any}) in core code and tests.
  • Replace JSON3 “pretty” output with JSON.jl output in serialization and documentation examples.
  • Update project/test/docs environments to depend on JSON instead of JSON3.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/base.jl Switch system JSON parsing/serialization from JSON3 to JSON.jl and update docstrings accordingly.
src/PowerSystems.jl Replace import JSON3 with import JSON.
test/common.jl Switch JSON parsing in serialization validation to JSON.jl.
test/test_plant_attributes.jl Update JSON import and parsing in plant attribute tests.
test/test_generate_structs.jl Update JSON parsing for generated-struct descriptor validation.
test/runtests.jl Replace test-suite JSON import to JSON.jl.
docs/src/how_to/parse_ts_from_csvs.md Update documentation examples to use JSON.jl instead of JSON3.
Project.toml Replace JSON3 dependency/compat with JSON and update InfrastructureSystems source pin.
test/Project.toml Replace JSON3 dependency/compat with JSON and add source pins for dependencies.
docs/Project.toml Replace JSON3 dependency with JSON for docs environment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/base.jl

open(filename, "w") do io
JSON3.pretty(io, metadata)
JSON.json(io, metadata; pretty = 2)
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

JSON.json in JSON.jl returns a String and does not take an IO as the first argument, and pretty is not a supported keyword in JSON.jl. To write pretty-formatted JSON to a file, use JSON.print(io, metadata; indent = 2) (or write the result of JSON.json(metadata; indent = 2) to io).

Suggested change
JSON.json(io, metadata; pretty = 2)
JSON.print(io, metadata; indent = 2)

Copilot uses AI. Check for mistakes.
fname = joinpath(FORECASTS_DIR, "timeseries_pointers_da.json"); # hide
open(fname, "r") do f # hide
JSON3.@pretty JSON3.read(f) # hide
JSON.json(JSON.parse(f; dicttype = Dict{String, Any}); pretty = 2) # hide
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

In JSON.jl, pretty is not a valid keyword (use indent), and JSON.json(...) produces a string rather than printing like JSON3.@pretty. If the intention is to display formatted JSON in the docs build, switch to an API that prints (e.g., JSON.print(...; indent = 2) or println(JSON.json(...; indent = 2))).

Suggested change
JSON.json(JSON.parse(f; dicttype = Dict{String, Any}); pretty = 2) # hide
JSON.print(JSON.parse(f; dicttype = Dict{String, Any}); indent = 2) # hide

Copilot uses AI. Check for mistakes.
Comment thread test/Project.toml
Comment on lines 25 to +28

[sources]
InfrastructureSystems = {url = "https://github.com/NREL-Sienna/InfrastructureSystems.jl", rev = "jd/drop_json3"}
PowerSystemCaseBuilder = {url = "https://github.com/NREL-Sienna/PowerSystemCaseBuilder.jl", rev = "psy6"}
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

Committing [sources] pins tests to specific branches/SHAs and can unexpectedly change dependency resolution in CI and for contributors running the test environment, reducing reproducibility. Prefer relying on registry versions (via [compat]) and/or using a Manifest.toml for CI pinning, or keep these overrides out of the committed test/Project.toml unless they’re strictly required long-term.

Suggested change
[sources]
InfrastructureSystems = {url = "https://github.com/NREL-Sienna/InfrastructureSystems.jl", rev = "jd/drop_json3"}
PowerSystemCaseBuilder = {url = "https://github.com/NREL-Sienna/PowerSystemCaseBuilder.jl", rev = "psy6"}

Copilot uses AI. Check for mistakes.
@jd-lara
Copy link
Copy Markdown
Member Author

jd-lara commented Apr 22, 2026

the tests will still fail until TableDataParser is merged onto the registry

@jd-lara jd-lara merged commit edb5b78 into psy6 Apr 27, 2026
6 of 13 checks passed
@jd-lara jd-lara deleted the jd/drop_json3 branch May 13, 2026 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants