I do this "/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"skeleton"}}" and the spawner transforms into a pig spawner but the skeletons do spawn though. However when I change it to peaceful and put the spawner near the grasses it'll spawn pigs.
Use