Search
 
SCRIPT & CODE EXAMPLE
 

LUA

lua json decode

local personString = '{"name": "Squid", "job": "dev"}' -- A JSON string
-- If you need to turn the json into an object:
local personJSON = json.decode(personString)
-- Now you can use it like any table:
personJSON["name"] = "Illusion Squid"
personJSON.job = "Software Engineer"
-- If you have an object and want to make it a JSON string do this:
local newPersonString = json.encode(personJSON)
-- Simple!
Comment

lua json decode

-- If you do not use this for FiveM, there are several packages that can do what you are looking for.
-- I would recommend the implementation that FiveM has in pure LuA, it is very easy to use. 
-- https://github.com/citizenfx/fivem/blob/master/code/tools/build/json.lua

-- You use it like this:

local table = {x = 5}
local encodeTable = json.encode(table) -- returns '{"x":5}'
local decodedTable = json.decode(encodedTable) -- returns {x = 5}
print(decodedTable.x) -- returns 5
Comment

PREVIOUS NEXT
Code Example
Lua :: how to delete parts with a script in roblox studio 
Lua :: roblox random number generator 
Lua :: round to the nearest number lua 
Lua :: lua how to make a loop 
Lua :: string.match roblox 
Lua :: roblox table find 
Lua :: function return lua 
Lua :: how to split strings into 2 string by space lua 
Lua :: roblox hotkey script 
Lua :: check if child is touched roblox 
Lua :: lua split 
Lua :: while main.lua 
Lua :: check player role in group 
Lua :: Ackermann function lua 
Lua :: how do i use the love errors module lua assist 
Lua :: Lua how to comment 
Matlab :: matlab delete file 
Matlab :: octave wait 
Matlab :: octave return dimensions 
Basic :: visual basic how to create a dynamic button 
Basic :: how to dynamically change the font size of a button visual basic 
Elixir :: elixir write base64 to file 
Elixir :: phoenix ecto query bindingess 
Scala :: scala map example 
Scala :: scala list of options to option of list 
Excel :: google sheet split text 
Perl :: perl post condition 
Perl :: first line perl 
Powershell :: windows 10 debloat 
Gdscript :: godot saving enum names in variable 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =