Open
Description
Here is the content of json file
{
"1": "1",
"2": "2",
"3": "3",
"4": "4"
}
here is my code
local cjson = require "cjson"
local function load_file(user_conf_file)
local f = io.open(user_conf_file)
if not f then
return nil
end
local cont = f:read("*a")
f:close()
local fjson = cjson.decode(cont)
for k, v in pairs(fjson) do
print(k)
end
return true
end
The output order is different each time,such as1432, 3142 .
So what is the sorting basis for key values after decode
? Is there a way to guarantee the original order?
Metadata
Metadata
Assignees
Labels
No labels