diff --git a/Project.toml b/Project.toml index 09ac8cac7..13135b32a 100644 --- a/Project.toml +++ b/Project.toml @@ -14,6 +14,7 @@ Expect = "6a31a4e8-6e70-5a2d-b005-bc2d500d80a5" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59" +JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" LogDensityProblems = "6fdf6af0-433a-55f7-b3ed-c6c6e0b8df7c" LogDensityProblemsAD = "996a588d-648d-4e1f-a8f0-a84b347e47b1" diff --git a/src/Pigeons.jl b/src/Pigeons.jl index 2d4c07728..b911bb7fa 100644 --- a/src/Pigeons.jl +++ b/src/Pigeons.jl @@ -40,6 +40,7 @@ using ZipFile using ForwardDiff using LogDensityProblems using LogDensityProblemsAD +using JSON import Serialization.serialize import Serialization.deserialize diff --git a/src/targets/StanLogPotential.jl b/src/targets/StanLogPotential.jl index 453941704..1b676aa3b 100644 --- a/src/targets/StanLogPotential.jl +++ b/src/targets/StanLogPotential.jl @@ -48,10 +48,6 @@ $SIGNATURES Create a JSON string based on the scalar or array variables provided. """ -json(; variables...) = - "{" * - join( - map( - pair -> "\"$(pair[1])\" : $(pair[2])", - collect(variables)), ",") * - "}" + + +json(; variables...) = JSON.json(Dict(pairs(variables)))