|  | 3 | 1 |  | JSON.json(jws::JSONWorksheet) = JSON.json(data(jws)) | 
|  | 5 | 2 |  | JSON.json(jws::JSONWorksheet, indent) = JSON.json(data(jws), indent) | 
|  |  | 3 |  |  | 
|  |  | 4 |  | function write(file::Union{String, IO}, jws::JSONWorksheet; indent = 2, drop_null = false) | 
|  | 6 | 5 |  |     open(file, "w") do io | 
|  |  | 6 |  |         data = JSON.json(jws, indent) | 
|  |  | 7 |  |         # drop null array such as [null, null, ....] | 
|  |  | 8 |  |         if drop_null | 
|  |  | 9 |  |             data = replace(data, r"(\"[\w]*\":null,)|(,?\"[\w]*\":null)" => "") | 
|  |  | 10 |  |         end | 
|  |  | 11 |  |         Base.write(io, data) | 
|  |  | 12 |  |     end | 
|  |  | 13 |  | end | 
|  |  | 14 |  |  | 
|  |  | 15 |  | function write(path::String, jwb::JSONWorkbook; kwargs...) | 
|  | 2 | 16 |  |     f = splitext(basename(xlsxpath(jwb)))[1] | 
|  | 1 | 17 |  |     for s in sheetnames(jwb) | 
|  | 3 | 18 |  |         write(joinpath(path, "$(f)_$(s).json"), jwb[s]; kwargs...) | 
|  |  | 19 |  |     end | 
|  |  | 20 |  | end | 
|  |  | 21 |  |  | 
|  |  | 22 |  | function write_xlsx(file::String, jwb::JSONWorkbook; delim = ";", anchor_cell = "A1") | 
|  | 2 | 23 |  |     XLSX.openxlsx(file, mode="w") do xf | 
|  |  | 24 |  |  | 
|  | 2 | 25 |  |         for (i, s) in enumerate(sheetnames(jwb)) | 
|  | 3 | 26 |  |             jws = jwb[s] | 
|  | 3 | 27 |  |             if i == 1 | 
|  | 1 | 28 |  |                 sheet = xf[1] | 
|  | 1 | 29 |  |                 XLSX.rename!(sheet, s) | 
|  |  | 30 |  |             else | 
|  | 2 | 31 |  |                 sheet = XLSX.addsheet!(xf, s) | 
|  |  | 32 |  |             end | 
|  |  | 33 |  |  | 
|  | 3 | 34 |  |             labels = map(el -> "/" * join(el.tokens, "/"), jws.pointer) | 
|  | 3 | 35 |  |             columns = [] | 
|  | 3 | 36 |  |             for p in jws.pointer | 
|  | 32 | 37 |  |                 data = get.(jws.data, Ref(p), missing) | 
|  | 32 | 38 |  |                 if eltype(data) <: Array | 
|  | 4 | 39 |  |                     data = join.(data, delim) | 
|  |  | 40 |  |                 end | 
|  | 35 | 41 |  |                 push!(columns, data) | 
|  |  | 42 |  |             end | 
|  |  | 43 |  |  | 
|  | 3 | 44 |  |             XLSX.writetable!(sheet, columns, labels, anchor_cell=XLSX.CellRef(anchor_cell)) | 
|  |  | 45 |  |         end | 
|  |  | 46 |  |     end | 
|  |  | 47 |  | end |