serializes dictionaries