JSFiddle - React, Tailwind, and code Playground

by wZVanG

HTML

<pre></pre>

CSS

pre {white-space: pre-wrap; max-width:100%}

JavaScript

var importes  = [{"Fecha":{"Month":1,"Year":2015},"Importe":1},{"Fecha":{"Month":2,"Year":2015},"Importe":1},{"Fecha" :{"Month":3,"Year":2015},"Importe":1},{"Fecha":{"Month":4,"Year":2015},"Importe":1},{"Fecha":{"Month":5,"Year":2015},"Importe":1},{"Fecha":{"Month":5, "Year":2014},"Importe":1},{"Fecha":{"Month":6,"Year":2014},"Importe":1},{"Fecha":{"Month":7,"Year":2014},"Importe":1},{"Fecha":{"Month":8,"Year":2014} ,"Importe":1},{"Fecha":{"Month":9,"Year":2014},"Im porte":1},{"Fecha":{"Month":10,"Year":2014},"Importe":1},{"Fecha":{"Month":11,"Year":2014},"Importe" :1}];

var item, years = {}, datos = [], i = 0;
//Guardar en colección
while(item = importes[i++]){
	var year = item.Fecha.Year;
	!years[year] && (years[year] = [year + ""]);
	years[year][item.Fecha.Month] = item.Importe
}
//Convertir en array
for(var x in years){
	var arr = years[x], y = 0;
	while(y++ < 12) !arr[y] && (arr[y] = 0);
	datos.push(arr)
}
//Ordenar
datos.sort(function(a, e){
	return a[0] + e[0]
});

document.querySelector("pre").innerHTML = JSON.stringify(datos);