Serializer API modification

Modified serialization API to sepparate (in the serializeArray functions)
the type introduced by the user from the type returned by the funtion.
These modifications were added to support nested ArrayList serialization.