JSON to Lua Table Converter for FiveM
Bidirectional conversion between JSON and Lua table syntax. Handles nested objects, arrays, booleans, and null/nil.
What this tool is for
Data arrives as JSON from an API, from a database export or from another script, and a FiveM config wants a Lua table. The two look similar enough that people convert them by hand, and then a null, a key with a dash in it or a nested array quietly breaks the file. This converter handles both directions and gets the edge cases right.
How to use it
- Step 1:
Paste your JSON into the left field, or switch direction to turn a Lua table back into JSON.
- Step 2:
Convert. Nested objects, arrays, booleans and null are translated, null becomes nil.
- Step 3:
Check keys that are not plain identifiers. They come out in bracket notation because Lua requires it.
- Step 4:
Copy or download the result and drop it into your config or resource.
Frequently asked questions
How is null converted?
null becomes nil, and that has a consequence: a nil value in a Lua table removes the key rather than storing an empty value. A JSON array with a null in the middle therefore ends up shorter and with a hole in its numbering.
Why do some keys come out in square brackets?
Lua only allows the plain key = value form for valid identifiers. Keys with dashes, spaces or a leading digit have to be written as ["my-key"], otherwise the file does not parse.
Do arrays keep their order?
Yes, an array becomes a numbered table and the order is preserved. Remember that Lua counts from 1, not from 0, so the first element of your JSON array is index 1 in Lua.
Can I convert a whole config back to JSON?
The reverse direction handles clean data tables. What it cannot take is Lua code inside the table, such as function definitions or concatenations, because JSON has no way to represent them.
Related tools
FiveM Config.lua Validator & Checker
Validate FiveM Config.lua files instantly. Check for syntax errors, missing commas, unclosed strings, unmatched brackets. Highlights errors with line numbers.
FiveM Lua Code Formatter & Beautifier
Format, beautify and minify Lua code for FiveM. Proper indentation for if/then/end, function/end blocks. Syntax highlighting, copy formatted output instantly.
FiveM Coordinates Finder & Vector Calculator
FiveM coordinate tool: convert between vector3, vector4, JSON formats. Calculate distance & midpoint between two points. Generate Lua code for GetEntityCoords/SetEntityCoords.