commit 168092ed6a4ce3b95dcf3b7abba942fa8ca91b3b
parent d67bd9abccea42ff33f092b4740296183691f19a
Author: Erik Loualiche <eloualiche@users.noreply.github.com>
Date: Tue, 3 Mar 2026 08:06:06 -0600
Merge pull request #9 from LouLouLibs/fix/json-object-precompile
Fix precompilation: replace JSON.Object with AbstractDict
Diffstat:
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/JSONLines.jl b/src/JSONLines.jl
@@ -199,26 +199,17 @@ end
# --------------------------------------------------------------------------------------------------
"""
- _dict_of_json(obj::JSON.Object) -> Dict{Symbol, Any}
+ _dict_of_json(obj::AbstractDict) -> Dict{Symbol, Any}
-Recursively convert a `JSON.Object` (from JSON.jl) into a standard Julia `Dict` with `Symbol` keys.
+Recursively convert a parsed JSON dictionary into a `Dict` with `Symbol` keys.
-This function traverses the input `JSON.Object`, converting all keys to `Symbol` and recursively converting any nested `JSON.Object` values. Non-object values are left unchanged.
-
-# Arguments
-- `obj::JSON.Object`: The JSON object to convert.
-
-# Returns
-- `Dict{Symbol, Any}`: A Julia dictionary with symbol keys and values converted recursively.
-
-# Notes
-- This function is intended for internal use and is not exported.
-- Useful for converting parsed JSON objects into standard Julia dictionaries for easier manipulation.
+All string keys are converted to `Symbol` and nested dictionaries are converted recursively.
+Non-dict values are left unchanged.
"""
-function _dict_of_json(d::JSON.Object)
+function _dict_of_json(d::AbstractDict)
result = Dict{Symbol, Any}()
for (k, v) in d
- result[Symbol(k)] = v isa JSON.Object ? _dict_of_json(v) : v
+ result[Symbol(k)] = v isa AbstractDict ? _dict_of_json(v) : v
end
return result
end