@@ -29,9 +29,11 @@ sizeguess(::Null) = 4
2929sizeguess (:: Omit ) = 0
3030sizeguess (_) = 512
3131
32+ const StringLike = Union{Enum, AbstractChar, VersionNumber, Cstring, Cwstring, UUID, Dates. TimeType, Type, Logging. LogLevel}
33+
3234StructUtils. lower (:: JSONStyle , :: Missing ) = nothing
3335StructUtils. lower (:: JSONStyle , x:: Symbol ) = String (x)
34- StructUtils. lower (:: JSONStyle , x:: Union{Enum, AbstractChar, VersionNumber, Cstring, Cwstring, UUID, Dates.TimeType, Type, Logging.LogLevel} ) = string (x)
36+ StructUtils. lower (:: JSONStyle , x:: StringLike ) = string (x)
3537StructUtils. lower (:: JSONStyle , x:: Regex ) = x. pattern
3638StructUtils. lower (:: JSONStyle , x:: AbstractArray{<:Any,0} ) = x[1 ]
3739StructUtils. lower (:: JSONStyle , x:: AbstractArray{<:Any, N} ) where {N} = (view (x, ntuple (_ -> :, N - 1 )... , j) for j in axes (x, N))
250252
251253StructUtils. lowerkey (:: JSONStyle , s:: AbstractString ) = s
252254StructUtils. lowerkey (:: JSONStyle , sym:: Symbol ) = String (sym)
253- StructUtils. lowerkey (:: JSONStyle , n :: Union{Integer, Union{Float16, Float32, Float64}} ) = string (n )
255+ StructUtils. lowerkey (:: JSONStyle , s :: Union{StringLike, Real} ) = string (s )
254256StructUtils. lowerkey (:: JSONStyle , x) = throw (ArgumentError (" No key representation for $(typeof (x)) . Define StructUtils.lowerkey(::JSON.JSONStyle, ::$(typeof (x)) )" ))
255-
256257"""
257258 JSON.json(x) -> String
258259 JSON.json(io, x)
0 commit comments