If you are looking how to display the live transaction feed on the blockchain you should check out this step-by-step tutorial on using their websocket API.
BROKEN LINK
If you don't want to do websocket and only want a "plain vanilla" JSON array of the most recent unconfirmed transactions you can simply use https://blockchain.info/unconfirmed-transactions?format=json
EDIT: Link no longer available, pasted below
<html>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
var btcs = new WebSocket('wss://ws.blockchain.info/inv');
btcs.onopen = function()
{
btcs.send( JSON.stringify( {"op":"unconfirmed_sub"} ) );
};
btcs.onmessage = function(onmsg)
{
var response = JSON.parse(onmsg.data);
var amount = response.x.out[0].value;
var calAmount = amount / 100000000;
$('#messages').prepend("<p>" + calAmount + "</p>");
}
</script>
<body>
<div id="messages"></div>
</body>
</html>
So we started by creating the variable var btcs
and then we had that be equal to the new websocket connection. Now that we have a connection to the websocket we need to send it a message and tell blockchain.info which information we are interested in receiving. We are going to use the onopen
and send
properties on our btcs
variable and create a function that subscribes us to {"op":"unconfirmed_sub"}
which is new transactions to the bitcoin network.
JSON.stringify
will send a JSON request to the websocket server telling it that we want to receive updates on new transactions to the network. At this point the server will start sending "messages" to the client everytime there is a new transaction. We need to tell javascript what to do everytime a message is received using the onmessage
command. Create a new function using onmessage
and I'm going to name the function onmsg
. Within that function we will parse the JSON using the data command.
At this point you could stick this script into an HTML document and when you run it, it will start shooting out all the new transactions as objects in JSON format into your browsers debug/console. If you look at it you'll notice they all start with utx
and then all the transaction data is under x
. The data within the x
array includes input
and out
. If we want info form the input area we would call the response
variable and then add in .x.input
. However there can be multiple inputs and outs so we have to clarify which one. If we add in stright brackets and put a zero [0]that will get us information on the first item in the array. Here's an example that will get the BTC amount that was received by the first output.