How to GET minecraft world spawn with commands?

I tried a few things and I'm pretty sure the only way is setting the player's individual spawn point to something invalid (like 0 0 0), setting gamerule spawnRadius to 0, killing them, waiting until they respawn (like this) and then checking their coordinates.