# Read JSON file while interpolate a string

**URL:** <https://discourse.julialang.org/t/read-json-file-while-interpolate-a-string/23163>\
**Category:** General Usage\
**Created:** [April 15, 2019, 2:39pm UTC](https://discourse.julialang.org/t/read-json-file-while-interpolate-a-string/23163 "2019-04-15T14:39:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bsnyh](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Post date:** [April 15, 2019, 2:39pm UTC](https://discourse.julialang.org/t/read-json-file-while-interpolate-a-string/23163/1 "2019-04-15T14:39:09Z")

</div>

Hi. Suppose I have a .JSON file like the following.

```julia
{ 
   "path": "$dir/movies"
}

```

The julia code is like the following:

```julia
using LazyJSON
strJSONFl = String(read("myFile.json"))
v = LazyJSON.parse(strJSONFl)  
dir = @ __DIR__   
println( v["path"] ) 

```

Then, this will output “$dir/movies”. There is this extra backslash in the very beginning of the output, which I need to get rid of. Because I’d like to call `eval(v["path"])` afterwards.

Have you ever encountered similar situations?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [April 15, 2019, 3:20pm UTC](https://discourse.julialang.org/t/read-json-file-while-interpolate-a-string/23163/2 "2019-04-15T15:20:37Z")

</div>

> [@bsnyh](#):
>
> Because I’d like to call `eval(v["path"])` afterwards.

I would advise against `eval`ing unsanitized, arbitrary code read from a string/file.

You can find and replace the `$dir` with a [regex](https://docs.julialang.org/en/v1/manual/strings/#Regular-Expressions-1), or just matching agains the string `raw"$dir"`.
