Utilities API

Index

API

Mill.reflectinmodelFunction
reflectinmodel(sch::Schema, ex::Extractor, args...; kwargs...)

Using schema sch and extractor ex, first create a representative sample and then call Mill.reflectinmodel.

source
JsonGrinder.remove_nullsFunction
remove_nulls(js)

Return a new document in which all null values (represented as nothing in julia) are removed.

Examples

julia> remove_nulls(Dict("a" => 1, "b" => nothing))
Dict{String, Union{Nothing, Int64}} with 1 entry:
  "a" => 1

julia> [nothing, Dict("a" => 1), nothing, Dict("a" => nothing)] |> remove_nulls
2-element Vector{Dict{String}}:
 Dict("a" => 1)
 Dict{String, Nothing}()
source
JsonGrinder.map_keysFunction
map_keys(f, d)

Return a new document in which all keys are (recursively) transformed by callable f.

Examples

julia> d = Dict("a" => 1, "b" => Dict("c" => "foo"))
Dict{String, Any} with 2 entries:
  "b" => Dict("c"=>"foo")
  "a" => 1

julia> map_keys(Symbol, d)
Dict{Symbol, Any} with 2 entries:
  :a => 1
  :b => Dict(:c=>"foo")

julia> map_keys(string, d)
Dict{String, Any} with 2 entries:
  "b" => Dict("c"=>"foo")
  "a" => 1
source