We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e63a1bb commit ade3b28Copy full SHA for ade3b28
src/JSONTables.jl
@@ -11,12 +11,18 @@ struct Table{columnar, T}
11
end
12
13
function jsontable(source)
14
- x = JSON3.read(source)
+ x = !(source isa JSON3.Object || source isa JSON3.Array) ? JSON3.read(source) : source
15
columnar = x isa JSON3.Object && first(x)[2] isa AbstractArray
16
columnar || x isa JSON3.Array || throw(ArgumentError("input json source is not a table"))
17
return Table{columnar, typeof(x)}(x)
18
19
20
+function jsontable(x::JSON3.Object)
21
+ columnar = first(x)[2] isa AbstractArray
22
+ columnar || x isa JSON3.Array || throw(ArgumentError("input json source is not a table"))
23
+ return Table{columnar, typeof(x)}(x)
24
+end
25
+
26
Tables.istable(::Type{<:Table}) = true
27
28
# columnar source
0 commit comments