Array of individual transactions from blockchain.info As a little learning/hobby project i'm writing a little c++ program to extract a list of transactions from blockchain.info and show it visually.

I was hoping i could iterate through blocks, taking each TX and then extract into an array a list of transactions. i.e.
Block/transactionID/sending_address/amount/receiving_address etc

Ive connected to blockchain.info and can iterate through each block using jsoncpp. But if i look at an example like this:

https://blockchain.info/block-height/100001?format=json

...and specifically transactions like this:
https://blockchain.info/rawtx/8131ffb0a2c945ecaf9b9063e59558784f9c3a74741ce6ae2a18d0571dac15bb

Will the sum of inputs always match the sum of outputs?  How would i marry up which input sent what amount to each output when there is more than 1 in each?

Many Thanks.
nice - but I promise, it will not be a "little" project :-) 


  Will the sum of inputs always match the sum of outputs?


no! There is a general rule, that whatever is the difference, will be miner fees. To be more precise, the miner is free to take it as fees. So this is a reason why you should have always "return" addresses in your transactions. 


  How would i marry up which input sent what amount to each output when
  there is more than 1 in each?


The idea of bitcoin transactions is, that they are not linked directly to  addresses, but to previous transactions. And they are not "divisible", but more "additional". I try to explain: funds are transferred from a previous transaction to a new location. Your wallet software might easily handle several addresses. If you send from your wallet to a new target, the wallet might have to take 2 or 3 or 4 previous tx, to send to new address, cause the funds on the single tx where insufficient for the total amount. In this sense, you (your C++ code) can only "match" inputs to outputs (with the derived addresses). Many huge transactions have hundreds of inputs and/or outputs - imagine faucets or exchanges: they create 1 transaction, with many payouts to different owners/users (e.g. https://blockchain.info/de/tx/2062a2717ca2f77c6935ff685d33086aa5db2f554ecd4d5232432cf9cb6a4006). 

Taking your example: one can see that 5 inputs were required, to spend 250BTC to 15xif4SjXiFi3NDEsmMZCfTdE9jvvVQrjU and 1mio Satoshis to 1NkKLMgbSjXrT7oHagnGmYFhXAWXjJsKCj. That's nearly all you can say, what happened in this tx. The analogy from Andreas (and his book "Mastering Bitcoin", online readable, highly recommended) is FIAT money. You have maybe 10, 20 and 50 Euro bills in your wallet, but don't know from whom. Now you want to pay 35 Euros. So you give 50, and receive maybe 3 times 5 Euros as change. You still don't know, from whom they came, but just the amount. These "three times 5 Euros" could then be used as 3 inputs for a new 15 Euros transaction.