title: Convert JSON String to Lua Table?
body: <p>I need to convert a Json String to a table data structure in Lua. I am using the following code.</p>
  
  <pre><code>local json = require "json"
  
  local t = { 
      ["name1"] = "value1",
      ["name2"] = { 1, false, true, 23.54, "a \021 string" },
      name3 = json.null
  }
  
  local encode = json.encode (t)
  print (encode)  --&gt; {"name1":"value1","name3":null,"name2":[1,false,true,23.54,"a \u0015 string"]}
  
  local decode = json.decode( encode )
  </code></pre>
  
  <p>But when I run the script, I get the following errors,</p>
  
  <pre><code>    no field package.preload['json']
      no file '/usr/local/share/lua/5.2/json.lua'
      no file '/usr/local/share/lua/5.2/json/init.lua'
      no file '/usr/local/lib/lua/5.2/json.lua'
      no file '/usr/local/lib/lua/5.2/json/init.lua'
      no file './json.lua'
      no file '/usr/local/lib/lua/5.2/json.so'
      no file '/usr/local/lib/lua/5.2/loadall.so'
      no file './json.so'
  </code></pre>
  
  <p>So how to convert my json string to lua table? </p>