syntax error, unexpected keyword_end, expecting ')' : <p>I have a script called <code>import.rb</code> which will import json content from url to drafts directory.</p>

<pre><code>require 'fileutils'
require 'json'

# Load JSON data from source
# (Assuming the data source is a json file on your file system)
data = JSON.parse('https://script.google.com/macros/s/AKfycbyHFt1Yz96q91-D6eP4uWtRCcF_lzG2WM-sjrpZIr3s02HrICBQ/exec')

# Proceed to create post files if the value array is not empty
array = data["user"]
if array &amp;&amp; !array.empty?
  # create the `_drafts` directory if it doesn't exist already
  drafts_dir = File.expand_path('./_drafts', __dir__)
  FileUtils.mkdir_p(posts_dir) unless Dir.exist?(drafts_dir)

  # iterate through the array and generate draft-files for each entry
  # where entry.first will be the "content" and entry.last the "title"
  array.each do |entry|
    File.open(File.join(drafts_dir, entry.last), 'wb') do |draft|
      draft.puts("---\n---\n\n#{entry.first}"
    end
  end
end
</code></pre>

<p>When I run <code>ruby _scripts/import.rb</code> I get <code>_scripts/import.rb:20: syntax error, unexpected keyword_end, expecting ')'
    end</code> error. I changed line from recommended form to <code>data = JSON.parse('https://script.google.com/macros/s/AKfycbyHFt1Yz96q91-D6eP4uWtRCcF_lzG2WM-sjrpZIr3s02HrICBQ/exec')</code>. Original was <code>data = JSON.parse(File.read(your_json_source.json))</code>. Please assist me.</p>
