So im trying to add a table inside another table but each time i do it, it adds a "1": from nowhere...
my code :
local previousClothes = json.decode(xPlayer.get('clothes'))
print("old previousClothes"..json.encode(previousClothes))
local clothes = {[label] = {[parentName] = parentValue, [partName] = partValue}}
print("old clothes"..json.encode(clothes))
clothes[#clothes+1] = previousClothes
print("new clothes: "..json.encode(clothes))
xPlayer.get('clothes') = my clothes stored in my db
local clothes = my new clothes received in the function/event
and here comes my issue.. it adds a "1": to my table
clothesis not an array. It contains key-value entries. So, JSON treats it as dictionary (object) instead of as array.