layers: add layer and layer_map to_json() helper