Serialization into json and binary