Align DataSize and Duration apis

Also make units json serializable