From f9812b429177b992046416ea3835a4ef3d33b5ed Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Mon, 26 Jan 2026 13:36:24 +1300 Subject: [PATCH 1/4] [FileFormats.MOF] replace JSON3 by JSON.jl --- Project.toml | 5 +++-- src/FileFormats/MOF/MOF.jl | 2 +- src/FileFormats/MOF/read.jl | 2 +- src/FileFormats/MOF/write.jl | 2 +- test/FileFormats/MOF/MOF.jl | 11 +++++++---- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Project.toml b/Project.toml index ab1e6af1dd..8b801b7e61 100644 --- a/Project.toml +++ b/Project.toml @@ -7,7 +7,8 @@ BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" CodecBzip2 = "523fee87-0ab8-5b00-afb7-3ecf72e48cfd" CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" -JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1" +JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +JSONSchema = "7d188eb4-7ad8-530c-ae41-71a32a6d4692" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MutableArithmetics = "d8a4904e-b15c-11e9-3269-09a3773c0cb0" NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" @@ -23,7 +24,7 @@ BenchmarkTools = "1" CodecBzip2 = "0.6, 0.7, 0.8" CodecZlib = "0.6, 0.7" ForwardDiff = "0.10, 1" -JSON3 = "1" +JSON = "1.4.0" JSONSchema = "1" LinearAlgebra = "<0.0.1, 1.6" MutableArithmetics = "1" diff --git a/src/FileFormats/MOF/MOF.jl b/src/FileFormats/MOF/MOF.jl index ad8d98ceab..d15fa2104c 100644 --- a/src/FileFormats/MOF/MOF.jl +++ b/src/FileFormats/MOF/MOF.jl @@ -7,7 +7,7 @@ module MOF import ..FileFormats -import JSON3 +import JSON import MathOptInterface as MOI """ diff --git a/src/FileFormats/MOF/read.jl b/src/FileFormats/MOF/read.jl index 89250cf66b..197f569508 100644 --- a/src/FileFormats/MOF/read.jl +++ b/src/FileFormats/MOF/read.jl @@ -13,7 +13,7 @@ function Base.read!(io::IO, model::Model) if !MOI.is_empty(model) error("Cannot read model from file as destination model is not empty.") end - object = JSON3.read(io, Dict{String,Any}) + object = JSON.parse(io; dicttype = Dict{String,Any}) file_version = _parse_mof_version(object["version"]::Dict{String,Any}) if !(file_version in _SUPPORTED_VERSIONS) version = _SUPPORTED_VERSIONS[1] diff --git a/src/FileFormats/MOF/write.jl b/src/FileFormats/MOF/write.jl index 1226adcc8b..98d9c740f8 100644 --- a/src/FileFormats/MOF/write.jl +++ b/src/FileFormats/MOF/write.jl @@ -33,7 +33,7 @@ function Base.write(io::IO, model::Model) if has_scalar_nonlinear object = (; has_scalar_nonlinear = true, object...) end - JSON3.write(io, object) + Base.write(io, JSON.json(object)) return end diff --git a/test/FileFormats/MOF/MOF.jl b/test/FileFormats/MOF/MOF.jl index 6eaa81ca8a..f934179945 100644 --- a/test/FileFormats/MOF/MOF.jl +++ b/test/FileFormats/MOF/MOF.jl @@ -8,7 +8,7 @@ module TestMOF using Test -import JSON3 +import JSON import JSONSchema import MathOptInterface as MOI @@ -17,7 +17,10 @@ const MOF = MOI.FileFormats.MOF const TEST_MOF_FILE = "test.mof.json" const SCHEMA = JSONSchema.Schema( - JSON3.read(read(MOI.FileFormats.MOF.SCHEMA_PATH, String), Dict{String,Any}), + JSON.parse( + read(MOI.FileFormats.MOF.SCHEMA_PATH, String); + dicttype = Dict{String,Any}, + ), ) function runtests() @@ -40,7 +43,7 @@ function _validate(filename::String) "r", MOI.FileFormats.AutomaticCompression(), ) do io - object = JSON3.read(io, Dict{String,Any}) + object = JSON.parse(io, Dict{String,Any}) ret = JSONSchema.validate(SCHEMA, object) if ret !== nothing error( @@ -1565,7 +1568,7 @@ function test_use_nlp_block() io = IOBuffer() write(io, model) seekstart(io) - object = JSON3.read(io, Dict{String,Any}) + object = JSON.parse(io, Dict{String,Any}) @test object["has_scalar_nonlinear"] == true @test JSONSchema.validate(SCHEMA, object) === nothing # Test (; use_nlp_block = nothing) From 5278a3f2d0792ac40dc31520b311fcfd2fe965c6 Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Mon, 26 Jan 2026 13:46:11 +1300 Subject: [PATCH 2/4] Update --- .github/workflows/ci.yml | 2 +- Project.toml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71ceefb819..4f25f33ab7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: - version: '1' os: windows-latest arch: x64 - - version: '1.6' + - version: '1.10' os: ubuntu-latest arch: x64 - version: '1' diff --git a/Project.toml b/Project.toml index 8b801b7e61..709e2f1fc6 100644 --- a/Project.toml +++ b/Project.toml @@ -26,16 +26,16 @@ CodecZlib = "0.6, 0.7" ForwardDiff = "0.10, 1" JSON = "1.4.0" JSONSchema = "1" -LinearAlgebra = "<0.0.1, 1.6" +LinearAlgebra = "1" MutableArithmetics = "1" NaNMath = "0.3, 1" OrderedCollections = "1" PrecompileTools = "1" -Printf = "<0.0.1, 1.6" -SparseArrays = "<0.0.1, 1.6" +Printf = "1" +SparseArrays = "1" SpecialFunctions = "0.8, 1, 2" -Test = "<0.0.1, 1.6" -julia = "1.6" +Test = "1" +julia = "1.10" [extras] JSONSchema = "7d188eb4-7ad8-530c-ae41-71a32a6d4692" From 3b75ba8339702d7cf88f7db85767df81eba1c77e Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Mon, 26 Jan 2026 14:15:36 +1300 Subject: [PATCH 3/4] Update --- Project.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 709e2f1fc6..930997db9b 100644 --- a/Project.toml +++ b/Project.toml @@ -8,7 +8,6 @@ CodecBzip2 = "523fee87-0ab8-5b00-afb7-3ecf72e48cfd" CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" -JSONSchema = "7d188eb4-7ad8-530c-ae41-71a32a6d4692" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MutableArithmetics = "d8a4904e-b15c-11e9-3269-09a3773c0cb0" NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" @@ -24,7 +23,7 @@ BenchmarkTools = "1" CodecBzip2 = "0.6, 0.7, 0.8" CodecZlib = "0.6, 0.7" ForwardDiff = "0.10, 1" -JSON = "1.4.0" +JSON = "1" JSONSchema = "1" LinearAlgebra = "1" MutableArithmetics = "1" From 259b10b8f7d56aaabdce80c326ad6dfb9ee1eb6f Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Mon, 26 Jan 2026 14:16:30 +1300 Subject: [PATCH 4/4] Update --- test/FileFormats/MOF/MOF.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/FileFormats/MOF/MOF.jl b/test/FileFormats/MOF/MOF.jl index f934179945..f607b6f172 100644 --- a/test/FileFormats/MOF/MOF.jl +++ b/test/FileFormats/MOF/MOF.jl @@ -43,7 +43,7 @@ function _validate(filename::String) "r", MOI.FileFormats.AutomaticCompression(), ) do io - object = JSON.parse(io, Dict{String,Any}) + object = JSON.parse(io; dicttype = Dict{String,Any}) ret = JSONSchema.validate(SCHEMA, object) if ret !== nothing error( @@ -1568,7 +1568,7 @@ function test_use_nlp_block() io = IOBuffer() write(io, model) seekstart(io) - object = JSON.parse(io, Dict{String,Any}) + object = JSON.parse(io; dicttype = Dict{String,Any}) @test object["has_scalar_nonlinear"] == true @test JSONSchema.validate(SCHEMA, object) === nothing # Test (; use_nlp_block = nothing)