How to serialize simple materials?
Decided to try the dir() approach until someone proposes a better solution. Seems to be working for simple materials without textures, as well as some modifiers, etc. To me this looks pretty dangerous, tho.

In order to later update Blender objects based on the generated dict, I had to skip read-only properties.

def bl_to_dict(bl_object, ignore_getters=True):
    """Generic Blender object to dict converter."""
    skip_attributes = ['__doc__', '__module__', '__slots__']
    supported_basetypes = [
        "&lt;class 'bool'&gt;", 
        "&lt;class 'int'&gt;", 
        "&lt;class 'float'&gt;", 
        "&lt;class 'str'&gt;", 
        "&lt;class 'list'&gt;",
        "&lt;class 'set'&gt;"
        ]
    # TODO:: Add support for more types for which casting helps.
    supported_casts = {
        "&lt;class 'Color'&gt;": 'list'
    }
    # TODO:: Figure out how to support bpy_prop_array, bpy_prop_collection, etc.
    # TODO:: Perhaps recurse on members of more complex classes.
    d = {}

    attributes = [x for x in dir(bl_object) if x not in skip_attributes]
    for name in attributes:
        # Get attribute value.
        val = getattr(bl_object, name)
        # Ignore getter properties.
        if ignore_getters:
            try:
                setattr(bl_object, name, val)
            except AttributeError as err:
                continue
        # Check against supported types.
        type_str = str(type(val))
        if type_str in supported_basetypes:
            d[name] = val
        elif type_str in supported_casts:
            d[name] = eval(supported_casts[type_str])(val)
        #else:
        #    print("Type {} of attribute {} not supported yet.".format(type(val), name))
    return d

def dict_to_bl(bl_obj, bl_dict):
    """Update a Blender object from a dict."""
    for key, val in bl_dict.iteritems():
        setattr(bl_obj, key, val)
    return bl_obj

# From here on it's easy to either convert the dict 
# to a string, to pickle, json, p-code or whatever it.


Disclaimer: The code is provided as-is. It's not guaranteed to work or anything. Getting and resetting random properties (basically what this code does) might seriously mess up stuff in Blender.