Page MenuHomePhabricator

The mw.loadData() Lua method should recognize JSON data
Closed, DeclinedPublic

Description

If the mw.loadData() tries to access a page with JSON data (content model) then it should read it in and convert it to a valid Lua structure.

Event Timeline

jeblad raised the priority of this task from to Needs Triage.
jeblad updated the task description. (Show Details)
jeblad added a project: Scribunto.
jeblad subscribed.

It could be that the method already does this, and I have messed up. :)

Jackmcbarn claimed this task.
Jackmcbarn subscribed.

We already have mw.text.jsonDecode to decode JSON.

This is about loading and decoding json. It is possible to get to JSON data by using frame:expandTemplate but this is not efficient in these cases and is sort of hackish.

Use mw.title.new('whatever'):getContent() to get the text in a non-hacky way.