Skip to content

serde

Vara's library for serialising and deserialising data.

local serde = require("@vara/serde")

local message = serde.Encode("JSON", { hello = "world", testing = 123 })
print(message)

local data : { hello: string, testing: number } = serde.Decode("JSON",message)
print(data.hello)
print(data.testing)

functions

Encode -> string

serde.Encode(
    format: SerdeFormat, 
    data: unknown
): string
Encodes the data provided into a specified file format.

Decode -> unknown

serde.Decode(
    format: SerdeFormat, 
    data: string
): unknown
Decode the data provided from a specified file format into luau values.


types

SerdeFormat

type SerdeFormat = "JSON" | "TOML" | "YAML"