RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Debug DrawingGPU Mesh StructsImGui FFIMath Structs (FFI)FFI C DefinitionsPID ControllersCSV LibraryDelay LineDequeDevelopment UtilitiesEvent ReferenceExtension SystemSignal FiltersGraph PathfindingUI BridgeInput Filter Constants2D Bilinear InterpolationIntrospectionJBeam Pretty PrinterJSON AST ParserSJSON ParserJSON Debug ParserJSON Pretty PrinterK-D Tree (2D Boxes)K-D Tree (3D)K-D Tree (3D)Lua SerializerC++/Lua BindingLua CoreLua ProfilerMath LibraryParticlesQuadtreeSettingsTCP ServerTimer SchedulerUtility Library

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

SJSON Parser

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

See Also

  • cdefDebugDraw Reference - Related reference
  • cdefGpuMesh Reference - Related reference
  • cdefImgui Reference - Related reference
  • Common Libraries Overview - Guide

JSON AST Parser

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

JSON Debug Parser

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 NotesSee Also