Skip to content
Open
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
4 changes: 2 additions & 2 deletions src/JSONTables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ function jsontable(x::JSON3.Object)
return Table{true, typeof(x)}(names, types, x)
end

jsontable(x::JSON3.Array) = throw(ArgumentError("input `JSON3.Array` must only have `JSON3.Object` elements to be considered a table"))
# jsontable(x::JSON3.Array) = throw(ArgumentError("input `JSON3.Array` must only have `JSON3.Object` elements to be considered a table"))
missT(::Type{Nothing}) = Missing
missT(::Type{T}) where {T} = T

function jsontable(x::JSON3.Array{JSON3.Object})
function jsontable(x::AbstractVector{<:JSON3.Object})
names = Symbol[]
seen = Set{Symbol}()
types = Dict{Symbol, Type}()
Expand Down
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,10 @@ jt = JSONTables.jsontable(new_field_in_last_row)
ct = Tables.columntable(jt)
@test isequal(ct.c, [missing, 8])

# jsontable(::Vector{JSON3.Object}) test
jstrs = JSON3.write.([Dict("a"=>rand(), "b"=>-rand()) for _ in 1:50])
js = JSON3.read.(jstrs)
jt = jsontable(js)
@test jt isa JSONTables.Table

end