RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

cdefDebugDraw ReferencecdefGpuMesh ReferencecdefImgui ReferencecdefMath Referencecdefs ReferencecontrolSystems Referencecsvlib ReferencedelayLine Referencedequeue ReferencedevUtils ReferenceEvent Referenceextensions Referencefilters Referencegraphpath Referenceguihooks ReferenceinputFilters ReferenceinterpolatedMap Referenceintrospection ReferencejbeamWriter Referencejson-ast Referencejson ReferencejsonDebug ReferencejsonPrettyEncoderCustom Referencekdtreebox2d Referencekdtreebox3d Referencekdtreepoint3d Referencelpack ReferenceluaBinding ReferenceluaCore ReferenceluaProfiler Referencemathlib Referenceparticles Referencequadtree Referencesettings ReferencetcpServer ReferencetimeEvents Referenceutils Reference

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API Referencecommon

json Reference

Module defined in `lua/common/json.lua`. High-performance SJSON (Simplified JSON) parser for Lua 5.1/LuaJIT. Supports standard JSON plus SJSON extensions: comments (`//`, `/* */`), unquoted keys, `=`

Module defined in lua/common/json.lua. High-performance SJSON (Simplified JSON) parser for Lua 5.1/LuaJIT. Supports standard JSON plus SJSON extensions: comments (//, /* */), unquoted keys, = as key-value separator, and trailing commas.


Exports

Functions

M.decode(si)

Parses a JSON/SJSON string into a Lua table.

  • Parameters:
    • si - string|nil - JSON string to parse
  • Returns: self (module table, for chaining)

Internal Notes

  • Dispatch-table driven parser - each byte value maps to a parsing function for maximum speed
  • Handles: objects {}, arrays [], strings "", numbers (including 1#INF00, scientific notation), booleans, null, Infinity
  • SJSON extensions: // single-line comments, /* */ block comments, unquoted alphanumeric keys, = as separator (in addition to :)
  • Temporarily stops the garbage collector during parsing for performance
  • Handles escape sequences: \t, \n, \f, \r, \b, \", \\
  • Error messages include approximate line numbers
  • Uses table.new and table.clear LuaJIT extensions with fallbacks
  • This is the fast/production parser; see jsonDebug.lua for the version with duplicate key warnings

json-ast Reference

Module defined in `lua/common/json-ast.lua`. A JSON/jbeam AST (Abstract Syntax Tree) parser that preserves formatting, comments, and whitespace. Used by the in-game jbeam editor for lossless round-tri

jsonDebug Reference

Module defined in `lua/common/jsonDebug.lua`. Debug variant of the SJSON parser that adds duplicate key detection. Structurally identical to `json.lua` but emits warnings when duplicate keys are found

On this page

ExportsFunctionsM.decode(si)Internal Notes