Fork me on GitHub

pull html data in json from a webpage

Feel free to use it for yourself, for good not evil!

Example queries which returns valid jsonp:

http://www.pulljson.com/jquery?site=jquery.com&selector=find('a').children()&callback=myjsonpcallback

JSONP example

	$('#demo-output-jsonp').show();
	$.ajax(
	{
		dataType:'jsonp',
		url:"http://pulljson.com/jquery?site=www.jquery.com&selector=find('a img')&callback=?",
		success:function(data) {
			var items = [];
			/*Puts into list found linksimages' alt text from jquery.com site*/
			$.each(data.results, function(key, val) {
				/* val.text refers to content of tags */
				items.push('<li id="' + key + '">' + val.attributes.alt + '</li>');
			});
			$('<ul/>', {
				'class': 'my-new-list',
				html: items.join('')
			}).appendTo('#demo-output-jsonp');
			$('#demo-output-loader-jsonp').hide();
		}
	});
	

CORS example

	$('#demo-output-cors').show();
	$.ajax(
	{
		dataType:'json',
		crossDomain: true,
		url:"http://pulljson.com/jquery?site=www.jquery.com&selector=find('a img')&callback=?",
		success:function(data) {
			var items = [];
			/*Puts into list found linksimages' alt text from jquery.com site*/
			$.each(data.results, function(key, val) {
				/* val.text refers to content of tags */
				items.push('<li id="' + key + '">' + val.attributes.alt + '</li>');
			});
			$('<ul/>', {
				'class': 'my-new-list',
				html: items.join('')
			}).appendTo('#demo-output-cors');
			$('#demo-output-loader-cors').hide();
		}
	});
	

about

In brief
This service is done mainly for mobile/tablet needs in mind to access web data via jsonp, CORS is also supported.
  • If you are just wondering how to access a nice json api via mobile I'd recommend https://jsonp.nodejitsu.com
  • If you need full power of (rich) javascript + actual event handling possibilties I'd recommend checking pjscrape
  • If you need reporting features(scheduled emails and diff reports) I'd recommend femtoo.com which uses cquery.com

Limitations
  • There will be hardly any navigation and interaction (read as javascript) support with service in web pages
  • This service and site is one developer's hobby project
  • Thus, the service and this site might be offline every now and then.

Other services
Certainly there are other tools besides this in the wild which operate similarly and have affected also creating this tool by myself with node.js.

To name some of those tools are
namequery methodsonline
anyorigin.comnone, one big content propertyonline
yahoo pipesxpathonline
pjscrape (phantomjs)jquerystandalone
google spreadsheetxpathonline
cquery.comcss selectorsonline

I'd see this service resembles most closely cquery. Yet, anyorigin might seem very similar also at first look but there are differences how 'jquery' is used.

Building blocks of this site

See http://github.com/santeriv/pulljson