Moved exception throwing into JSON root module, implemented JSON.encode!