Is there a good tutorial for using JSON in Julia?

I am starting to learn how to use JSON in Julia. I can create a json object, for sinatcne:

jsJ = JSON.json(Dict("name"=>["Paul", "Peter", "Jude", "Mark"],
    "level"=>[1, 10, 20, 30],
    "code"=>["Pa", "Pe", "Ju", "Mk"]))
# write to file
open("file.json", "w") do j
    write(j, jsJ)

Is there a good tutorial on how to use JSON from here? such as reading the first elements of the dictionary (as to get: Paul, 1, Pa) and appending elements to the object?
There is, of course, the link to the official distribution; is there something more simplified?
Thank you

Hi Luigi,

I am not aware of any. The reason might be that JSONs are loaded into the common Julia structures like Dict, Vector and String or Float64 and the tutorial would be common with tutorials of these structures. The function you ask is also very dependent on your data. You can quickly write it yourself as

julia> js = Dict("name"=>["Paul", "Peter", "Jude", "Mark"],
    "level"=>[1, 10, 20, 30],
    "code"=>["Pa", "Pe", "Ju", "Mk"])

julia> [k => first(v) for (k,v) in js]
3-element Vector{Pair{String}}:
  "name" => "Paul"
  "code" => "Pa"
 "level" => 1
1 Like

JSON3.jl has several examples.

Thank you!