<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.spheredev.org/index.php?action=history&amp;feed=atom&amp;title=Script%3AJson.js</id>
	<title>Script:Json.js - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.spheredev.org/index.php?action=history&amp;feed=atom&amp;title=Script%3AJson.js"/>
	<link rel="alternate" type="text/html" href="http://wiki.spheredev.org/index.php?title=Script:Json.js&amp;action=history"/>
	<updated>2026-11-08T01:01:53Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>http://wiki.spheredev.org/index.php?title=Script:Json.js&amp;diff=905&amp;oldid=prev</id>
		<title>Apollolux: lowercase title</title>
		<link rel="alternate" type="text/html" href="http://wiki.spheredev.org/index.php?title=Script:Json.js&amp;diff=905&amp;oldid=prev"/>
		<updated>2013-06-24T22:29:06Z</updated>

		<summary type="html">&lt;p&gt;lowercase title&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:29, 24 June 2013&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{lowercase title}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;JSON, which stands for [http://json.org JavaScript Object Notation], is more compact, less-process intensive alternative to XML. It&amp;#039;s a way to store complex data objects and restore them back to their original state, similar to PHP&amp;#039;s or Java&amp;#039;s serialization. What does this mean to Sphere? JSON can be used to save monster stats or complex event states in a way that which doesn&amp;#039;t involve creating custom routines to save various attributes to a comma-delimited file. The current version of the JavaScript-based JSON parser is named json2.js and while it retains the original API it boasts significant improvements in speed and efficiency.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;JSON, which stands for [http://json.org JavaScript Object Notation], is more compact, less-process intensive alternative to XML. It&amp;#039;s a way to store complex data objects and restore them back to their original state, similar to PHP&amp;#039;s or Java&amp;#039;s serialization. What does this mean to Sphere? JSON can be used to save monster stats or complex event states in a way that which doesn&amp;#039;t involve creating custom routines to save various attributes to a comma-delimited file. The current version of the JavaScript-based JSON parser is named json2.js and while it retains the original API it boasts significant improvements in speed and efficiency.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Apollolux</name></author>
	</entry>
	<entry>
		<id>http://wiki.spheredev.org/index.php?title=Script:Json.js&amp;diff=728&amp;oldid=prev</id>
		<title>Apollolux: /* Download */ typo</title>
		<link rel="alternate" type="text/html" href="http://wiki.spheredev.org/index.php?title=Script:Json.js&amp;diff=728&amp;oldid=prev"/>
		<updated>2013-06-08T00:02:26Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Download: &lt;/span&gt; typo&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 00:02, 8 June 2013&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l4&quot;&gt;Line 4:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 4:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;==Download==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;==Download==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;JSON parsing is built into [http://www.ecma-international.org/publications/standards/Ecma-262.htm &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;EMCAScript &lt;/del&gt;since 2007] but for JS engines that don&#039;t natively support it you can get a script from [http://json.org json.org], specifically [https://github.com/douglascrockford/JSON-js here].&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;JSON parsing is built into [http://www.ecma-international.org/publications/standards/Ecma-262.htm &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ECMAScript &lt;/ins&gt;since 2007] but for JS engines that don&#039;t natively support it you can get a script from [http://json.org json.org], specifically [https://github.com/douglascrockford/JSON-js here].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;==Usage==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;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;&quot;&gt;&lt;div&gt;==Usage==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Apollolux</name></author>
	</entry>
	<entry>
		<id>http://wiki.spheredev.org/index.php?title=Script:Json.js&amp;diff=666&amp;oldid=prev</id>
		<title>Apollolux: created from http://web.archive.org/web/20100621060813/http://www.spheredev.org/wiki/Json.js</title>
		<link rel="alternate" type="text/html" href="http://wiki.spheredev.org/index.php?title=Script:Json.js&amp;diff=666&amp;oldid=prev"/>
		<updated>2013-06-03T23:29:40Z</updated>

		<summary type="html">&lt;p&gt;created from http://web.archive.org/web/20100621060813/http://www.spheredev.org/wiki/Json.js&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;JSON, which stands for [http://json.org JavaScript Object Notation], is more compact, less-process intensive alternative to XML. It&amp;#039;s a way to store complex data objects and restore them back to their original state, similar to PHP&amp;#039;s or Java&amp;#039;s serialization. What does this mean to Sphere? JSON can be used to save monster stats or complex event states in a way that which doesn&amp;#039;t involve creating custom routines to save various attributes to a comma-delimited file. The current version of the JavaScript-based JSON parser is named json2.js and while it retains the original API it boasts significant improvements in speed and efficiency.&lt;br /&gt;
&lt;br /&gt;
What json2.js does is it installs additional methods to the JavaScript primitive types such as Object and Number which allow any object to be rendered down into a JSON string or vice-versa.&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
JSON parsing is built into [http://www.ecma-international.org/publications/standards/Ecma-262.htm EMCAScript since 2007] but for JS engines that don&amp;#039;t natively support it you can get a script from [http://json.org json.org], specifically [https://github.com/douglascrockford/JSON-js here].&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
Including json2.js in your game will provide a global &amp;quot;JSON&amp;quot; object with two static methods.&lt;br /&gt;
&lt;br /&gt;
*	&amp;#039;&amp;#039;&amp;#039;JSON.stringify&amp;#039;&amp;#039;&amp;#039;(&amp;#039;&amp;#039;value[, replacer, space]&amp;#039;&amp;#039;) - Converts &amp;lt;var&amp;gt;value&amp;lt;/var&amp;gt; into a JSON string. &amp;lt;var&amp;gt;replacer&amp;lt;/var&amp;gt; and &amp;lt;var&amp;gt;space&amp;lt;/var&amp;gt; are optional: they handle how objects without a toJSON() method are dealt with, and how the text is indented, respectively. See the file itself for details.&lt;br /&gt;
*	&amp;#039;&amp;#039;&amp;#039;JSON.parse&amp;#039;&amp;#039;&amp;#039;(&amp;#039;&amp;#039;text[, reviver]&amp;#039;&amp;#039;) - Converts the JSON string &amp;lt;var&amp;gt;text&amp;lt;/var&amp;gt; back into a JavaScript object. The optional &amp;lt;var&amp;gt;reviver&amp;lt;/var&amp;gt; parameter is a function that can transform, replace or remove each key-value pair as it is encountered. See the file itself for details.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
function Monster()&lt;br /&gt;
{&lt;br /&gt;
   this.fight = function ( who )&lt;br /&gt;
   {&lt;br /&gt;
      //do some fighting&lt;br /&gt;
   };&lt;br /&gt;
 &lt;br /&gt;
   this.magic = function ( who )&lt;br /&gt;
   {&lt;br /&gt;
      //hocus-pocus&lt;br /&gt;
   };&lt;br /&gt;
 &lt;br /&gt;
   this.loadStats( str )&lt;br /&gt;
   {&lt;br /&gt;
      // take the json string, create an object and apply it to myself&lt;br /&gt;
      json = JSON.parse(str);&lt;br /&gt;
      for (prop in json)&lt;br /&gt;
      {&lt;br /&gt;
         this[prop] = json[prop];&lt;br /&gt;
      }&lt;br /&gt;
   };&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
// create an instance of a monster&lt;br /&gt;
var slime = new Monster();&lt;br /&gt;
slime.hp = 10;&lt;br /&gt;
slime.mp = 2;&lt;br /&gt;
slime.str = 2;&lt;br /&gt;
slime.magic = [&amp;#039;Hurt&amp;#039;,&amp;#039;Heal&amp;#039;,&amp;#039;Heal More&amp;#039;];&lt;br /&gt;
slime.exp = 3;&lt;br /&gt;
slime.name = &amp;quot;Green Slime&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
// save the stats of the slime&lt;br /&gt;
jsonslime = slime.toJSONString();&lt;br /&gt;
jsonslime = JSON.stringify(slime);&lt;br /&gt;
 &lt;br /&gt;
// kill it&lt;br /&gt;
delete slime;&lt;br /&gt;
 &lt;br /&gt;
// resurrect it&lt;br /&gt;
var slime = new Monster();&lt;br /&gt;
slime.loadStats(jsonslime);&lt;br /&gt;
 &lt;br /&gt;
// I&amp;#039;m back!&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Apollolux</name></author>
	</entry>
</feed>