JSON is a runtime input of unknown type but in your example those are known types so the compiler can catch them.