´óÏó´«Ã½

Please turn on JavaScript. To find out how to do this visit the .

Overview

Glow.net.data allows you to convert one data type to another. Below is an example that allows you to convert JSON and URL querystrings into one another.

Type in a JSON object into the left textarea, then click on one the button 'JSON to URL' to convert the object to a URL.

Here is the example code:

HTML

<textarea id="json"></textarea>
<input type="button" id="json_to_url" value="JSON to URL &gt;" rows="10" cols="20" />
<input type="button" id="url_to_json" value="&lt; URL to JSON" rows="10" cols="20" />
<textarea id="url"></textarea>

JavaScript

// json to url
glow.events.addListener("input#json_to_url", "click", function(event) {
	try {
		// Get the JSON
		var json = glow.data.decodeJson(glow.dom.get("textarea#json").val());
		// Encode to URL
		var url = glow.data.encodeUrl(json);
		// Output the encoded URL
		glow.dom.get("textarea#url").val(url);
	}
	catch(e) {
		glow.dom.get("textarea#url").val("The JSON was not properly formatted");
	}
});

// url to json
glow.events.addListener("input#url_to_json", "click", function(event) {
	try {
		// Get the URL
		var url = glow.data.decodeUrl(glow.dom.get("textarea#url").val());
		// Encode To JSON
		var json = glow.data.encodeJson(url);
		// Output the encoded JSON
		glow.dom.get("textarea#json").val(json);
	}
	catch(e) {
		glow.dom.get("textarea#json").val("The URL was not properly formatted");
	}
});

´óÏó´«Ã½ iD

´óÏó´«Ã½ navigation

´óÏó´«Ã½ © 2014 The ´óÏó´«Ã½ is not responsible for the content of external sites. Read more.

This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.