Do your layers all have the same set of options? You may consider creating one json object and applying it to yuor layer objects instead of re-creating the same json object each time