Deserialize Deployment json fails

Hi, after upgrading our dev databases, to the latest Litium only 3 of 5 of us can run the Accelerator Deployment process without any problems (To create a new demo site).
But two of us gets this error:

{"Could not cast or convert from System.String to Litium.Security.Operation."}

{"Error converting value \"Entity/Read\" to type 'Litium.Security.Operation'. Path 'website.childPages[0].accessControlList[0].operation', line 1181, position 38."}

         {
           "$type": "Litium.Security.AccessControlEntry, Litium.Abstractions",
           "groupSystemId": "5b521f8c-a7a2-44e0-ab76-1c60d740bded",
           "operation": "Entity/Read"
         }

I know to little about c# json to understand how the database could affect the deserialization, or what could be wrong, so am just hoping for any guesses or ideas at all.

Litium version: 7.1

Are you using the accelerator standard deployment or an own modified version of the deployment?

We used our own, but the B2C also failed on those systems (I’m 'told) but the above json snippet is from a custom export.

Will Verify this one more time.

Does the groupSystemId need to be in the database to deserialize the data? I just don’t understand how the database is invloved :smiley:

Try to use the Litium.Runtime.ApplicationJsonConverter for the conversation or of you need special settings you can fetch the JsonSerializerSettings from that service. The JsonSerializerSettings will have the inbuilt converters that is needed to convert Litium objects and the Operation have an own Newtonsoft.Json.JsonConverter to be able to convert between the json and object.

If using the JObject.ToObject(type) to convert objects you may enter the JsonSerilizer with the correct JsonSerilizerSettings into the ToObject-method to get it to work.

Sorry, I was to vage. We do use the standard deployment code, just a custom .bin export using the export option in deplayment.
So its the standard import code thats fails.

No, The items does not need to be in the database. The deserilization is creating the “entites” and then first when it is using the *Service.Create(entity) the item is created and in that case the group need to exists.

In the AcceleratorPackage.GetStructureInfo() we are deserilizing the values and it’s probably that line that will throw exception. We are using an extension method LoadDataCompressedJson (see below). In the LoadDataCompressedJson method we fetch the settings and on the settings it is possible to attach an TraceWriter. If you create a modified version that attach an trace writer you may get more information out that can point in the direction of why it fail.

public static T LoadDataCompressedJson<T>(this FileInfo fileInfo)
        {
            if (fileInfo.Directory != null && !fileInfo.Directory.Exists)
            {
                return default;
            }

            if (!fileInfo.Exists)
            {
                return default;
            }

            var setting = ApplicationConverter.JsonSerializerSettings();
            setting.TypeNameHandling = TypeNameHandling.Objects;
            ((ApplicationContractResolver)setting.ContractResolver).NamingStrategy.ProcessDictionaryKeys = true;

            var serializer = JsonSerializer.Create(setting);

            try
            {
                using (var w = fileInfo.OpenRead())
                using (var compressor = new DeflateStream(w, CompressionMode.Decompress))
                {
                    var sr = new StreamReader(compressor);
                    var jsonReader = new JsonTextReader(sr);
                    return serializer.Deserialize<T>(jsonReader);
                }
            }
            catch (Exception e) when (!(e is OutOfMemoryException))
            {
                fileInfo.Delete();
                return default;
            }
        }