title: LuaLaTex using fontspec package and luacode reading JSON file
body: <p>I'm using Latex since years but I'm new to embedded luacode (with Lualatex). Below you can see a simplified example:</p>
  
  <pre><code>\begin{filecontents*}{data.json}
      [
          {"firstName":"Max", "lastName":"Möller"},
          {"firstName":"Anna", "lastName":"Smith"}
      ];
  \end{filecontents*}
  
  \documentclass[11pt]{article}
  
  \usepackage{fontspec}
  %\setmainfont{Carlito}
  
  \usepackage{tikz}
  \usepackage{luacode}
  
  \begin{document}
  \begin{luacode}
      require("lualibs.lua")
      local file = io.open('data.json','rb')
      local jsonstring = file:read('*a')
      file.close()
  
      local jsondata =  utilities.json.tolua(jsonstring)
  
      tex.print('\\begin{tabular}{cc}')
      for key, value in pairs(jsondata) do
          tex.print(value["firstName"] .. ' &amp; ' .. value["lastName"] .. '\\\\')
      end
      tex.print('\\hline\\end{tabular}')
  \end{luacode}
  \end{document}
  </code></pre>
  
  <p>When executing Lualatex following error occurs:</p>
  
  <pre><code>LuaTeX error [\directlua]:6: attempt to index field 'json' (a nil value) [\directlua]:6: in main chunk. \end{luacode}
  </code></pre>
  
  <p>When commenting the line <code>\usepackage{fontspec}</code> the output will be produced. Alternatively, the error can be avoided by commenting <code>utilities.json.tolua(jsonstring)</code> and all following lua-code lines.</p>
  
  <p>So the question is: How can I use both "fontspec" package and json-data without generating an error message? Apart from this I have another question: How to enable german umlauts in output of luacode (see first "lastName" in example: Möller)?</p>
  
  <p>Ah, I'm using TeX Live 2015/Debian on Ubuntu 16.04.</p>
  
  <p>Thank you,
  Jerome</p>