ObjectAttributes.FromJSON() SerializationException

When I try to create a ObjectAttributes(Rhino 7) instance from a JSON string I get the following error:
Runtime error (SerializationException): Unable to read CommonObject from base64 encoded string

python sample code:

options = Rhino.FileIO.SerializationOptions()
options.WriteUserData = True
for obj in Rhino.RhinoDoc.ActiveDoc.Objects:
    att_json = obj.Attributes.ToJSON(options)
    python_dict = json.loads(att_json)
    system_dict = System.Collections.Generic.Dictionary[str, str]()
    for k, v in python_dict.items():
        system_dict.Add(k, str(v))
    obj_att = Rhino.DocObjects.ObjectAttributes.FromJSON(system_dict)  # SerializationException

Does it work correctly if you feed it the json string rather than the dictionary you created?

obj_att = Rhino.DocObjects.ObjectAttributes.FromJSON(att_json)  # SerializationException

If I put att_json in, I get the same SerializationException.

Hi @jinaia87,

Looks like this issue is resolved in the Rhino 8 Beta.


ā€“ Dale

1 Like

I have confirmed that it works fine in Rhino 8 Beta, thank you.
Are you going to update it for 7 or lower as well?

Hi @jinaia87,

This update will not be back ported to Rhino 7, sorry.

ā€“ Dale