Improve encoding to use string_view if possible and to make creation of lists/dicts easier