The second form uses object expressions. See the section on object expressions in the manual.
The expression you gave will pick either 1, 2 or 3, and use that as an index ID (IID) to the 'spawn' object, and return that instance's X co-ordinate. If this is not a syntax error then there must be a different kind of object in your project called 'spawn', so you are using the X co-ordinate of an entirely different object. Your first example uses dfferent object types with different names (spawn1, spawn2 and spawn3) but the second expression will never look at those object types.
In short, it's probably working correctly but you have misunderstood what the expression is supposed to do.