From c968e563fd65cf554c25416743f82f24e95d0ac1 Mon Sep 17 00:00:00 2001 From: Beforerr Date: Sun, 26 May 2024 22:50:05 -0700 Subject: [PATCH] feat: Add support for FileIO --- src/JSON.jl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/JSON.jl b/src/JSON.jl index b3396f0..3cfaf6f 100644 --- a/src/JSON.jl +++ b/src/JSON.jl @@ -28,6 +28,11 @@ using .Serializations: Serialization, CommonSerialization, # for pretty-printed (non-compact) output, JSONText must be re-parsed: Writer.lower(json::JSONText) = parse(json.s) +# support for FileIO +# load(file::File{format"JSON"}, kwargs...) = parsefile(filename(file), kwargs...) +fileio_load(file; kwargs...) = parsefile(file.filename; kwargs...) +fileio_save(file, data) = write(file, json(data)) + function _precompile_() ccall(:jl_generating_output, Cint, ()) == 1 || return nothing x = "{\"type\":\"callback\",\"data\":{\"callback\":1,\"result\":true,\"error\":false}}"