Tools

Lua ↔ JSON

Paste a Lua table such as a FiveM Config.lua and get JSON, or paste JSON and get a tidy Lua table. A small real parser reads the data: nothing is run, and mistakes are reported with line and column.

Options

What was changed

  • Removed the leading `Config =`; only the value is converted.
  • vector2/3/4 and vec2/3/4 constructors (2 times) became objects with x, y, z, w keys, since JSON has no vector type.
  • A table mixes array-style entries with other keys, so JSON object keys were used ("1", "2", ... for positional values, "true"/"false" for boolean keys).
  • Comments were dropped: JSON has no comments.

How the conversion works

  • Only data is read. Variables, function calls and arithmetic are never evaluated; they produce an error with the exact line and column.
  • A table with keys 1..n (positional, or [1]=, [2]=…) is a JSON array; anything else is an object. Non-string keys become strings.
  • nil becomes null; a nil inside a list keeps its slot. Gaps in integer keys are not padded: that table becomes an object.
  • vector2/3/4 and vec2/3/4 become {x, y, z, w} objects.
  • Supported: both quote styles, escapes, [[long strings]], hex/float/exponent numbers, -- comments, and a leading return or local Config =. One top-level value per input.

Runs entirely in your browser. Nothing you type is sent to us.