Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/write.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ StructUtils.lower(::JSONStyle, x::AbstractArray{<:Any,0}) = x[1]
StructUtils.lower(::JSONStyle, x::AbstractArray{<:Any, N}) where {N} = (view(x, ntuple(_ -> :, N - 1)..., j) for j in axes(x, N))
StructUtils.lower(::JSONStyle, x::AbstractVector) = x

# for pre-1.0 compat, which serialized Tuple object keys by default
StructUtils.lowerkey(::JSONStyle, x::Tuple) = string(x)

"""
JSON.omit_null(::Type{T})::Bool
JSON.omit_null(::JSONStyle, ::Type{T})::Bool
Expand Down
4 changes: 4 additions & 0 deletions test/json.jl
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,10 @@ end
@test result == expected
end
end

@testset "Test pre-1.0 compat for object Tuple keys" begin
@test JSON.json(Dict(("a", "b") => 1)) == "{\"(\\\"a\\\", \\\"b\\\")\":1}"
end
end

end # @testset "JSON.json"
Loading