Encoding for base types and maps