You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When I use Util.JsonEncode on a LUA Object with index 0 (followed by 1, 2, 3, etc), the returned JSON string represents an array.
LUA "arrays" (as I understand with ipairs) have indices starting with 1, so my example should be considered as an object when it is converted to JSON.
The result string is ["a",true,0.1] but should be {0:"a",1:true,2:0.1}
Expected behavior
When passing to Util.JsonEncode a table containing an index out of the range 1-N (or present in subobjects), it should return an object and not an array
Desktop (please complete the following information):
OS Windows 11 Pro
BeamMP Server v3.4.1
The text was updated successfully, but these errors were encountered:
Have you read our FAQ/Wiki/#before-you-ask ?
Yes
Describe the bug
When I use Util.JsonEncode on a LUA Object with index 0 (followed by 1, 2, 3, etc), the returned JSON string represents an array.
LUA "arrays" (as I understand with ipairs) have indices starting with 1, so my example should be considered as an object when it is converted to JSON.
To Reproduce
Steps to reproduce the behavior:
["a",true,0.1]
but should be{0:"a",1:true,2:0.1}
Expected behavior
When passing to Util.JsonEncode a table containing an index out of the range 1-N (or present in subobjects), it should return an object and not an array
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: