From the reference libraryRedM

autodoc_shared_functions

jo_libs/modules/utils/autodoc/autodoc_shared_functions.md

autodoc_shared_functions

JO Functions > jo.utils.convertToTable()

A function to convert a value to table if it's not already a table <br>

JO Functions > jo.utils.convertToTable() > Syntax

jo.utils.convertToTable(value, key)

JO Functions > jo.utils.convertToTable() > Parameters

value : any

The value to move inside a table

key : string

The key of the value inside the new table

JO Functions > jo.utils.convertToTable() > Return Value

Type : table

The new table with {key = value}

JO Functions > jo.utils.convertToTable() > Example

local hash = 12345
local data = jo.utils.convertToTable(hash,"myHash")
print(json.encode(data))
-- Expected ouput: {"myHash":12345}
Back to documentation