# Read a dictionary JLD2 file dumped by python in julia

**URL:** <https://discourse.julialang.org/t/read-a-dictionary-jld2-file-dumped-by-python-in-julia/57418>\
**Category:** Performance\
**Tags:** jld, json, dictionary, jld2\
**Created:** [March 17, 2021, 9:38pm UTC](https://discourse.julialang.org/t/read-a-dictionary-jld2-file-dumped-by-python-in-julia/57418 "2021-03-17T21:38:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastian\_Mena](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sebastian_mena/32/22819_2.png) [@Sebastian\_Mena](https://discourse.julialang.org/u/Sebastian_Mena)\
**Post date:** [March 17, 2021, 9:38pm UTC](https://discourse.julialang.org/t/read-a-dictionary-jld2-file-dumped-by-python-in-julia/57418/1 "2021-03-17T21:38:11Z")

</div>

Hi,

I am trying to import a dictionary that I saved in python with the extension .jld2  
First, I tried this code to do that:

```julia
> using JSON
> using DataStructures
> using JLD2
> dict_name = load("path/dict_name.jld2")

```

And, throw me this error:

`UndefVarError: load not defined`

Then, I tried with this:

```julia
> using JSON
> using DataStructures
> using JLD2
> dict_name = @load "path/dict_name.jld2" 

```

But it is imported as an array object.

**Could you help me with the correct code to import it as a dictionary?**

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [March 17, 2021, 9:41pm UTC](https://discourse.julialang.org/t/read-a-dictionary-jld2-file-dumped-by-python-in-julia/57418/2 "2021-03-17T21:41:32Z")

</div>

Simply changing the extension won’t give you a proper JLD2 file.

---

<div class="post-metadata">

**Author:** ![Sebastian\_Mena](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sebastian_mena/32/22819_2.png) [@Sebastian\_Mena](https://discourse.julialang.org/u/Sebastian_Mena)\
**Post date:** [March 17, 2021, 9:43pm UTC](https://discourse.julialang.org/t/read-a-dictionary-jld2-file-dumped-by-python-in-julia/57418/3 "2021-03-17T21:43:16Z")

</div>

it was a mistake when writing it  
Now I corrected it in the first post, I still have the doubt …

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [March 17, 2021, 10:17pm UTC](https://discourse.julialang.org/t/read-a-dictionary-jld2-file-dumped-by-python-in-julia/57418/4 "2021-03-17T22:17:04Z")

</div>

how did you create a JLD2 file from python? JLD2 is a julia pkg
