Search the Community
Showing results for tags 'fromjson'.
-
Alright, I've got the following JSON saved in my mysql: [ [ { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 } ], [ { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 } ] , [ { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 } ] ] It are 6 elements inside 3 elements. Each of these 3 elements holds 6x the { "lastPlayed": 0, "experience": 0, "money": 20 }. Whenever I'm using fromJSON, it's returning the wrong information when I'm trying to access the first element out of the second collection. The code I'm using is as following: local saveData = fromJSON ( data [ 1 ].saves ); outputChatBox ( #saveData ); -- returns 6 elements (incorrect) outputChatBox ( #saveData [ 2 ] ); -- returns 3 properties (correct) outputChatBox ( tostring ( saveData [ 2 ] [ 1 ] ) ); -- returns nil The JSON is valid, I can use it in different languages too and every parser says it's correct. I'm starting to think that fromJSON is returning just the first collection instead of all 3. Has anyone encountered this problem? I'm not really a fan of putting it all into 1 collection, it's preventing me from adding more and more data later on.