Not printed correctly into JSON
When printing a Measument to JSON, the resulting file in not valid due to ± sign.
using Measurements
using JSON
begin
open("test.json", "w") do io
JSON.print(io, Dict("value" => 1.1 ± 3.3))
end
#
open("test.json") do io
JSON.parse(io)
end
end
throws,
Expected ',' here
...when parsing byte with value '194'
posted here https://github.com/JuliaIO/JSON.jl/issues/375
It might turn out not JSON problem, rather Measurements.jl problem, since JSON.jl does not have rules for customary objects.
I guess you want to define a custom JSON.lower method. But deserialisation is up to the reader, since it's just interpreting a dictionary.
it's not clear to me how to make two package working together without making one to depend on the other.
I want that JSON.print write a valid JSON file, or throw an error if it cannot.
it's not clear to me how to make two package working together without making one to depend on the other.
https://pkgdocs.julialang.org/v1/creating-packages/#Conditional-loading-of-code-in-packages-(Extensions)
Do you suggest it for Measurements.jl?
Pkgextensions are symmetrical, can be hosted in any of the trigger packages.