DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Simple JSON Formatting Example

03.23.2008
| 6485 views |
  • submit to reddit
        // Simple JSON formatting example

({

	'google' : {
	
		'action': 'http://www.google.com.au/search',
		
		'method': 'POST',		
		
		'input': [
		
			'<input type="hidden" value="en" name="hl"/>',
			
			'<input value="" title="Google Search" size="55" name="q" maxlength="2048"/>',
			
			'<input type="hidden" value="en" name="hl"/>'
		
		],
		
		'buttons': [
		
			'<input type="submit" value="Google Search" name="btnG"/>',
			
			'<input type="submit" value="I\'m Feeling Lucky" name="btnI"/>'
		
		],
		
		'image': 'http://www.google.com/intl/en_ALL/images/logo.gif'
		
	},
	
	'yahoo' : {
	
		'action': 'http://search.yahoo.com/search',
		
		'method': 'POST',		
		
		'input': [
		
			'<input value="" maxlength="255" name="q" id="search" type="text">'
		
		],
		
		'buttons': [
		
			'<input value="Search" type="submit">'
		
		],
		
		'image': 'http://us.i1.yimg.com/us.yimg.com/i/ww/beta/y3.gif'		
		
	},	

	'wikipedia' : {
	
		'action': 'http://en.wikipedia.org/wiki/Special:Search',
		
		'method': 'POST',
		
		'input': [
		
			'<input value="" name="search" type="text">'
		
		],
		
		'buttons': [
		
			'<input value="Search" name="go" type="submit">'
		
		],
		
		'image': 'http://en.wikipedia.org/images/wiki-en.png'		
		
	},	

	'imdb' : {
	
		'action': 'http://imdb.com/find',
		
		'method': 'POST',
		
		'input': [
		
			'<input value="" name="q">'
		
		],
		
		'buttons': [
		
			'<input value="Search" type="submit">'
		
		],
		
		'image': 'http://i.media-imdb.com/images/nb15/logo2.gif'		
		
	},	

	'ebay' : {
	
		'action': 'http://search.ebay.com.au/search/search.dll',
		
		'method': 'GET',
		
		'input': [
		
			'<input value="R40" name="from" type="hidden">',
			
			'<input name="satitle" maxlength="300" type="text">'
		
		],
		
		'buttons': [
		
			'<input value="Search" type="submit">'
		
		],
		
		'image': 'http://pics.ebaystatic.com/aw/pics/logos/logoEbay_x45.gif'		
		
	},		
	
	'dictionary' : {
	
		'action': 'http://dictionary.com/search',
		
		'method': 'GET',
		
		'input': [
		
			'<input maxlength="256" value="" name="q" type="text">'
		
		],
		
		'buttons': [
		
			'<input value="Search" type="submit">'
		
		],
		
		'image': 'http://cache.lexico.com/g/d/dictionary_logo.gif'		
		
	},	

	'iboogie' : {
	
		'action': 'http://www.iboogie.com/searchtree.asp',
		
		'method': 'GET',
		
		'input': [
		
			'<input type="text" value="test" name="name_query" />'
		
		],
		
		'buttons': [
		
			'<input type="submit" value=" Search " class="button"/>'
		
		],
		
		'image': 'http://www.iboogie.com/images/iboogie_us.jpg'		
		
	},		
	
})