Encode from schema NSData.