https://de.wikipedia.org/w/index.php?action=history&feed=atom&title=Wikipedia%3ALua%2FModul%2FJSONutil%2Fen
Wikipedia:Lua/Modul/JSONutil/en - Versionsgeschichte
2025-07-28T16:32:19Z
Versionsgeschichte dieser Seite in Wikipedia
MediaWiki 1.45.0-wmf.11
https://de.wikipedia.org/w/index.php?title=Wikipedia:Lua/Modul/JSONutil/en&diff=205886645&oldid=prev
PerfektesChaos: +
2020-11-24T14:32:30Z
<p>+</p>
<a href="//de.wikipedia.org/w/index.php?title=Wikipedia:Lua/Modul/JSONutil/en&diff=205886645&oldid=190640240">Änderungen zeigen</a>
PerfektesChaos
https://de.wikipedia.org/w/index.php?title=Wikipedia:Lua/Modul/JSONutil/en&diff=190640240&oldid=prev
PerfektesChaos: update
2019-07-22T09:55:52Z
<p>update</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="de">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Nächstältere Version</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version vom 22. Juli 2019, 11:55 Uhr</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Zeile 9:</td>
<td colspan="2" class="diff-lineno">Zeile 9:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><noinclude>__TOC__</noinclude></div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><noinclude>__TOC__</noinclude></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== {{Anker|template}} Functions for templates ==</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== {{Anker|template}} Functions for templates ==</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>; failsafe<del style="font-weight: bold; text-decoration: none;"> {{Anker|</del>failsafe<del style="font-weight: bold; text-decoration: none;">}}</del></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>; <ins style="font-weight: bold; text-decoration: none;"><span id="</ins>failsafe<ins style="font-weight: bold; text-decoration: none;">"></ins>failsafe<ins style="font-weight: bold; text-decoration: none;"></span></ins></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>: Version ID: <code>{{#invoke:JSONutil|failsafe}}</code></div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>: Version ID: <code>{{#invoke:JSONutil|failsafe}}</code></div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>: optional parameter <code>1</code> – required version, or keyword <code>wikidata</code></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>: optional parameter <code>1</code> – required version, or keyword <code>wikidata<ins style="font-weight: bold; text-decoration: none;"></code> or keyword&nbsp;<code>~</ins></code></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>: ''Returns:''</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>: ''Returns:''</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>:* <del style="font-weight: bold; text-decoration: none;">(</del>empty<del style="font-weight: bold; text-decoration: none;">)</del>, if minimal version condition not matched</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>:* <ins style="font-weight: bold; text-decoration: none;">''</ins>empty<ins style="font-weight: bold; text-decoration: none;">''</ins>, if minimal version condition not matched</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>:* local version otherwise, or registered on Wikidata (<code>{{#invoke:JSONutil|failsafe|wikidata}}</code>) when <code>wikidata</code></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>:* local version otherwise, or registered<ins style="font-weight: bold; text-decoration: none;"> version</ins> on Wikidata (<code>{{#invoke:JSONutil|failsafe|wikidata}}</code>) when<ins style="font-weight: bold; text-decoration: none;"> keyword</ins> <code>wikidata</code></div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>:* ''empty'', if keyword <code>~</code> and a registered version on Wikidata is the same as local; otherwise local version ID (<code>{{#invoke:JSONutil|failsafe|~}}</code>)</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></onlyinclude></div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></onlyinclude></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== {{Anker|Lua}} Functions for Lua modules (API) ==</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== {{Anker|Lua}} Functions for Lua modules (API) ==</div></td>
</tr>
</table>
PerfektesChaos
https://de.wikipedia.org/w/index.php?title=Wikipedia:Lua/Modul/JSONutil/en&diff=189688502&oldid=prev
PerfektesChaos: m
2019-06-19T14:22:28Z
<p>m</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="de">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Nächstältere Version</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version vom 19. Juni 2019, 16:22 Uhr</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Zeile 75:</td>
<td colspan="2" class="diff-lineno">Zeile 75:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== See also ==</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== See also ==</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* [[:en:User:PerfektesChaos/js/jsonDebug|jsonDebug@PerfektesChaos]] – <del style="font-weight: bold; text-decoration: none;">Benutzerskript</del> <del style="font-weight: bold; text-decoration: none;">zur</del> <del style="font-weight: bold; text-decoration: none;">detaillierteren</del> <del style="font-weight: bold; text-decoration: none;">Analyse</del> <del style="font-weight: bold; text-decoration: none;">fataler</del> <del style="font-weight: bold; text-decoration: none;">Fehler</del></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* [[:en:User:PerfektesChaos/js/jsonDebug|jsonDebug@PerfektesChaos]] – <ins style="font-weight: bold; text-decoration: none;">User</ins> <ins style="font-weight: bold; text-decoration: none;">JavaScript</ins> <ins style="font-weight: bold; text-decoration: none;">for</ins> <ins style="font-weight: bold; text-decoration: none;">detailed</ins> <ins style="font-weight: bold; text-decoration: none;">analysis</ins> <ins style="font-weight: bold; text-decoration: none;">of fatal JSON errors</ins></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></onlyinclude></div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></onlyinclude></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Kategorie:Wikipedia:Lua/Modul/Dokumentation|JSONutil/en]]</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Kategorie:Wikipedia:Lua/Modul/Dokumentation|JSONutil/en]]</div></td>
</tr>
</table>
PerfektesChaos
https://de.wikipedia.org/w/index.php?title=Wikipedia:Lua/Modul/JSONutil/en&diff=189649401&oldid=prev
PerfektesChaos: k
2019-06-18T15:42:49Z
<p>k</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="de">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Nächstältere Version</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version vom 18. Juni 2019, 17:42 Uhr</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Zeile 23:</td>
<td colspan="2" class="diff-lineno">Zeile 23:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> JSONutil = JSONutil.JSONutil()</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> JSONutil = JSONutil.JSONutil()</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>else</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>else</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> -- failure; <del style="font-weight: bold; text-decoration: none;">WLink</del> is the error message</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> -- failure; <ins style="font-weight: bold; text-decoration: none;">JSONutil</ins> is the error message</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> return "<span class=\"error\">" .. JSONutil .. "</span>"</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> return "<span class=\"error\">" .. JSONutil .. "</span>"</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>end</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>end</div></td>
</tr>
</table>
PerfektesChaos
https://de.wikipedia.org/w/index.php?title=Wikipedia:Lua/Modul/JSONutil/en&diff=189340350&oldid=prev
PerfektesChaos: Setup
2019-06-07T14:36:35Z
<p>Setup</p>
<p><b>Neue Seite</b></p><div>{{LuaModuleDoc}}<br />
<onlyinclude><br />
'''<code>JSONutil</code>''' – Module with functions for preparation and analysis of [[JavaScript Object Notation|JSON]] code strings.<br />
<br />
Line breaks and tabulators within string values will be accepted and converted.<br />
<br />
Rather than a global “Invalid” message it will be tried to detect some typical errors and communicate them together with context.<br />
<br />
<noinclude>__TOC__</noinclude><br />
== {{Anker|template}} Functions for templates ==<br />
; failsafe {{Anker|failsafe}}<br />
: Version ID: <code>{{#invoke:JSONutil|failsafe}}</code><br />
: optional parameter <code>1</code> – required version, or keyword <code>wikidata</code><br />
: ''Returns:''<br />
:* (empty), if minimal version condition not matched<br />
:* local version otherwise, or registered on Wikidata (<code>{{#invoke:JSONutil|failsafe|wikidata}}</code>) when <code>wikidata</code><br />
</onlyinclude><br />
== {{Anker|Lua}} Functions for Lua modules (API) ==<br />
All functions described above can be used by other modules:<br />
<syntaxhighlight lang="lua"><br />
local lucky, JSONutil = pcall( require, "Module:JSONutil" )<br />
if type( JSONutil ) == "table" then<br />
JSONutil = JSONutil.JSONutil()<br />
else<br />
-- failure; WLink is the error message<br />
return "<span class=\"error\">" .. JSONutil .. "</span>"<br />
end<br />
</syntaxhighlight><br />
Subsequently there are available:<br />
; JSONutil.[[#failsafe|failsafe]](atleast)<br />
: Version ID<br />
:* atleast<br /> ''optional''<br /> ''nil'' or required version or <code>"wikidata"</code><br />
: returns: ''string'' or ''false''<br />
; JSONutil.fair(apply)<br />
: Reduce enhanced JSON data to strict JSON and analyse for errors.<br />
:* apply<br /> ''string'' with JSON code<br />
: returns: ''string'' or ''false''<br />
:# ''string'' with error keyword, or <code>false</code> if no complaints.<br />
:# ''string'' with error context, or clean JSON code if no complaints.<br />
; JSONutil.fault(alert, add, adapt)<br />
: Retrieve formatted message in best language<br />
:* alert<br /> ''string'' with error keyword<br />
:* add<br /> ''optional''<br /> ''string'' with error context<br />
:* adapt<br /> ''optional'' – [[#adapt|language preferences]]<br />
: returns: ''string'' with HTML error message.<br />
; JSONutil.fetch(apply, always, adapt)<br />
: Convert JSON robust into Lua<br />
:* apply<br /> ''string'' with JSON code<br />
:* always<br /> ''optional''<br /> <code>true</code>, if always preemptive test for free line format and strict JSON code being performed<br /> Meaningful for migration HHVM→PHP7 2019 to discover problems also in HHVM mode.<br />
:* adapt<br /> ''optional'' – [[#adapt|language preferences]]<br />
: returns: ''string'' or ''table''<br />
:* ''string'' with HTML error message in best language.<br />
:* ''table'' with JSON data.<br />
<br />
== {{Anker|adapt}} Language preferences ==<br />
The argument <code>adapt</code> provides adaption of message language and might be one of these types:<br />
* <code>function</code> – Callback<br />
** Return value is best message text<br />
** Two arguments: <br />
**# ''table'', with mapping: language code → message text<br />
**# ''string'', optional, with message text if ''table'' fails<br />
** [[../../Multilingual/en#i18n()|i18n@Multilingual]] would work<br />
* <code>string</code> – space-separated list of preferred language codes<br />
* false/nil – project language, else English<br />
<br />
== Dependencies ==<br />
''None''.<br />
<onlyinclude><br />
== Usage ==<br />
Useful for Lua programming only.<br />
<br />
== Internationalisation ==<br />
* [[commons:Data:I18n/Module:JSONutil.tab]] – Text elements<br />
* Error messages will be shown in user or project language, if available.<br />
<br />
== See also ==<br />
* [[:en:User:PerfektesChaos/js/jsonDebug|jsonDebug@PerfektesChaos]] – Benutzerskript zur detaillierteren Analyse fataler Fehler<br />
</onlyinclude><br />
[[Kategorie:Wikipedia:Lua/Modul/Dokumentation|JSONutil/en]]</div>
PerfektesChaos