Petrichor.Json#
Petrichor.Json is a JSON encoder/decoder bundled with Petrichor (rxi/json.lua 0.1.2). It is preloaded in the Luau VM, so require("Petrichor.Json") always works without a file in your mod folder.
Petrichor.Storage uses this module internally when saving store.json.
Loading#
API#
Json.encode(value) -> string#
Encodes a Luau value as JSON.
Supported types: nil, booleans, numbers, strings, and tables. Use contiguous integer keys starting at 1 for arrays, string keys for objects.
Json.decode(string) -> value#
Parses JSON into Luau values. Errors on invalid input.
Example: mod config file#
Use Storage.asset() to read a bundled config file and Json.decode to parse it.
For persistent player data, use Petrichor.Storage directly.