0

Couldn't find anything related to this, I have a field in my database which is the inventory data, I have this array as string form:

[{type:'item_standard',name:'hdlred',label:'Xenon Vermelho',weight:1,rare:0,can_remove:1,price:93,count:3},
{type:'item_standard',name:'hdlred',label:'Xenon Vermelho',weight:1,rare:0,can_remove:1,price:93,count:3},]

I wonder how I can convert that so then I can loop through every index (Lua), sorry for this newbie question but I really am mocking myself for this...

iCodeTits
  • 15
  • 8

1 Answers1

0

Here's an exmple using dkjson:

local json = require("dkjson")
local dataTable, pos, err = json.decode(yourstring)

if not dataTable then print(err) end

You might need to add some quotation marks around the keys in your json string though.

Piglet
  • 27,501
  • 3
  • 20
  • 43