Issue #13093 has been updated by Nobuyoshi Nakada.

Description updated
Status changed from Open to Feedback

I got a `NameError`.

```
-:1:in `<main>': undefined local variable or method `remplace_template' for main:Object (NameError)
```

----------------------------------------
Bug #13093: JSON Parse
https://bugs.ruby-lang.org/issues/13093#change-62354

* Author: Hector Flores
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
When trying to parse a JSON file from the following format:

```
[
{"original":"yahoo.fr","replace":"yahoo.fr"},
{"original":"zahnen.cl","replace":"zahnen.cl"},
{"original":"zzion.cl","replace":"zzion.cl"}
]
```

using the following code:

```ruby
file=remplace_template

def replace_template
   # Reads the file
   file=File.read 'replaces.json'
   JSON.parse(file,{symbolize_names: true, object_class: true})
end
```

I got the attached error file

---Files--------------------------------
error.log (19.9 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>