Leaflet.js and geojson with wrong order of latitude and longitude

Leaflet and geojson might sometimes have issues because of a standards confusion. This is how to fix it

You might end up with geojson that has latitude and longitude in different order than what leaflet.js expects. If that is the case, here is what you need:

L.geoJSON(json, {
    coordsToLatLng: function(coords) {
        return new L.LatLng(coords[0], coords[1], coords[2]);
    }
}).addTo(mymap);

Voila!