Module:GetJSON: Difference between revisions

From AlternateWiki
Content added Content deleted
No edit summary
No edit summary
Tag: Reverted
Line 7: Line 7:
local m = {}
local m = {}
-- Load JSON data from the first argument passed to the module
-- Load JSON data from the first argument passed to the module
m.root = mw.loadJsonData(frame.args[1])
if mw.title.new(frame.args[1]).exists then
m.root = mw.text.jsonDecode(frame.args[1])
else
m.root = mw.loadJsonData(frame.args[1])
end
-- Function to split a key string by "."
-- Function to split a key string by "."
local function splitKey(key)
local function splitKey(key)