Skip to content

Lua to JSON Converter

Convert Lua table literals to JSON format with support for nested structures, arrays, and various data types

Category: code
Use Case: Game Configuration, Data Migration, API Integration
Privacy: 100% browser-based

Conversion Options

Recommended Settings

Best Practices

  • Always validate converted JSON output before using in production
  • Keep original Lua files as source of truth for configuration
  • Test edge cases like empty tables, nested structures, and mixed types
  • Use version control to track both Lua and JSON versions

Conversion Tips

  • Lua tables with sequential numeric keys convert to JSON arrays
  • Tables with string or mixed keys become JSON objects
  • Nil values are converted to JSON null
  • Functions and metatables cannot be converted and will cause errors

Most Popular

Most users convert Lua game configuration files with 2-space indentation for readability

When to Use This Tool

Game Configuration

Convert Lua configuration files from game engines (LÖVE, Corona, Roblox) to JSON for use in web dashboards, mobile apps, or cross-platform tools. Easily share game settings, level data, and character stats across different systems.

Data Migration

Migrate data from Lua-based systems to JSON-compatible platforms. Move configuration files, user data, or application settings from legacy Lua systems to modern JSON-based APIs and databases.

API Integration

Transform Lua data structures into JSON format for REST APIs, webhooks, or microservices. Enable Lua applications to communicate with JSON-based web services and integrate with modern cloud platforms.

Development Tools

Convert Lua table literals for debugging, testing, or documentation. Visualize complex Lua data structures in JSON format for easier inspection, comparison, and sharing with team members who prefer JSON.

How It Works

1

Paste your Lua table literal into the input field

2

Configure conversion options (indent, sort keys)

3

Click Convert to JSON to process

4

luaparse parses the Lua syntax into an AST

5

The converter transforms tables to arrays or objects

6

Download or copy the formatted JSON result

100% Private

Files never leave your device. All processing happens locally in your browser.

Lightning Fast

Powered by luaparse for optimal performance on modern browsers.

Open Source

Built with verified, open-source libraries. Fully transparent.

Frequently Asked Questions

What Lua syntax is supported?

This tool supports Lua table literals including nested tables, strings, numbers, booleans, and nil values. It handles both array-style tables (sequential numeric keys) and dictionary-style tables (string keys). Functions, metatables, and executable code are not supported.

How are Lua tables converted to JSON?

Tables with sequential numeric keys starting from 1 are converted to JSON arrays. Tables with string keys or mixed keys become JSON objects. Nil values become JSON null. The converter intelligently determines the best JSON structure based on your Lua table's key patterns.

Can I convert Lua code or functions?

No, this tool only converts Lua table literals (data structures). It cannot convert executable Lua code, function definitions, or code with metatables. If you need to convert configuration data that includes functions, you'll need to extract just the data portions.

What happens to comments in my Lua code?

Lua comments are ignored during parsing and won't appear in the JSON output. JSON doesn't support comments, so any documentation in your Lua comments should be preserved separately or converted to a documentation file.

Is my data processed securely?

Yes! All conversion happens entirely in your browser using JavaScript. Your Lua code is never sent to any server or stored anywhere. This tool works completely offline once the page loads, ensuring your data remains private.

Why did my conversion fail?

Common causes include: (1) Lua syntax errors in your input, (2) unsupported features like functions or metatables, (3) invalid table structures, or (4) special Lua-specific constructs that don't have JSON equivalents. Check the error message for specific details about what went wrong.