Added superclass JSONMarshallable check to JSON.encode.