serialize with schema