Any way of serializing Blender cycles materials data?
There is the rna_xml module, which produces pretty verbose xml

from rna_xml import rna2xml

rna2xml(root_node="MyRootName",
        root_rna=bpy.data.materials['Material'].node_tree)


produces (not full output).  There is also an rna2xml routine.  To output to a file use rna2xml(fw=f.write, ...) where f is a file.

&lt;MyRootName&gt;
  &lt;inputs&gt;
  &lt;/inputs&gt;
  &lt;links&gt;
    &lt;NodeLink is_valid="TRUE"
              from_node="ShaderNodeBsdfDiffuse::Diffuse BSDF"
              to_node="ShaderNodeOutputMaterial::Material Output"
              is_hidden="FALSE"&gt;
      &lt;from_socket&gt;
        &lt;NodeSocketShader name="BSDF"
                          identifier="BSDF"
                          is_output="TRUE"
                          hide="FALSE"
                          enabled="TRUE"
                          link_limit="4095"
                          is_linked="TRUE"
                          show_expanded="FALSE"
                          hide_value="FALSE"
                          node="ShaderNodeBsdfDiffuse::Diffuse BSDF"
                          type="SHADER"
                          bl_idname="NodeSocketShader"&gt;
        &lt;/NodeSocketShader&gt;
      &lt;/from_socket&gt;
      &lt;to_socket&gt;
        &lt;NodeSocketShader name="Surface"
                          identifier="Surface"
                          is_output="FALSE"
                          hide="FALSE"
                          enabled="TRUE"
                          link_limit="1"
                          is_linked="TRUE"
                          show_expanded="FALSE"
                          hide_value="FALSE"
                          node="ShaderNodeOutputMaterial::Material Output"
                          type="SHADER"
                          bl_idname="NodeSocketShader"&gt;
        &lt;/NodeSocketShader&gt;
      &lt;/to_socket&gt;
    &lt;/NodeLink&gt;
  &lt;/links&gt;
  &lt;nodes&gt;
    &lt;ShaderNodeOutputMaterial type="OUTPUT_MATERIAL"
                              location="300 300"
                              width="140"
                              width_hidden="42"
                              height="100"
                              dimensions="178.889 116.333"
                              name="Material Output"
                              label=""
                              parent="NONE"
                              use_custom_color="FALSE"
                              color="0.608 0.608 0.608"
                              select="TRUE"
                              show_options="TRUE"
                              show_preview="FALSE"
                              hide="FALSE"
                              mute="FALSE"
                              show_texture="FALSE"
                              shading_compatibility="{NEW_SHADING}"
                              bl_idname="ShaderNodeOutputMaterial"
                              bl_label="Material Output"
                              bl_description=""
                              bl_icon="NONE"
                              bl_static_type="OUTPUT_MATERIAL"
                              bl_width_default="140"
                              bl_width_min="100"
                              bl_width_max="320"
                              bl_height_default="100"
                              bl_height_min="30"
                              bl_height_max="30"
                              is_active_output="TRUE"&gt;
      &lt;inputs&gt;
        &lt;NodeSocketShader name="Surface"
                          identifier="Surface"
                          is_output="FALSE"
                          hide="FALSE"