Module:JsonEncode

local util_args = require('Module:ArgsUtil')

-- small wrapper to retieve string representation of a json version of a data table -- intended to be called via the expandtemplates api action -- this should not be used internally at all -- please do not delete even if it's not used anywhere

local p = {} function p.main(frame) local args = util_args.merge(true) tbl = require(('Module:%snames'):format(args[1])) -- if a table (e.g. Rolenames) has entries for both the integer & string versions of a number, we can't jsonEncode -- so let's just get rid of all string keys in cases like this -- realistically, this will not often be a problem and we aren't gonna care about the chance that -- ipairs may be not well-defined (i.e. there maybe skipped indices) for i in ipairs(tbl) do		tbl[tostring(i)] = nil end str = mw.text.jsonEncode(tbl) return str end return p