Handles attributes correctly in fromJson/fromXml #17