Rebuild examine index fail, cannot deserialize the current JSON array
r

Rasolo

over 1 year ago
I get an error when trying to rebuild the examine index (umbraco 12) this is a new issue from upgrading from 8 to 12. Any advice in solving? Error message: Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Umbraco.Cms.Core.Models.Blocks.BlockValue' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly. To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array. Path '', line 1, position 1. at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureArrayContract(JsonReader reader, Type objectType, JsonContract contract) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newto at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items) at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source) at Umbraco.Cms.Infrastructure.Examine.ContentIndexPopulator.IndexAllContent(Int32 contentParentId, Int32 pageIndex, Int32 pageSize, IReadOnlyList`1 indexes) at Umbraco.Cms.Infrastructure.Examine.ContentIndexPopulator.PopulateIndexes(IReadOnlyList`1 indexes) at Umbraco.Cms.Infrastructure.Examine.IndexPopulator.Populate(IIndex[] indexes) ...
uSync Migrations - custom Nested Content migration
r

Rich G

over 1 year ago
Hey, Appreciate the fantastic uSync migrations project I've inherited a v8 project that has a custom implementation of a Nested Content datatype. From what I can tell there's not much difference to the original Nested Content datatype, but I don't know the history of the project. I've recreated the DocType with a standard Nested Content DataType so I can see how the data is different in preparation to use uSync migrations. The data structure is the same it seems, but new lines are handled differently. Custom Nested Content
<layout>
      <Value><![CDATA[[
  {
    "key": "f0a8df2b-f1f4-4a80-9c16-2b70a52216ae",
    "name": "Standard",
    "ncContentTypeAlias": "standard",
    "pageHeader": [
      {
        "key": "d7774230-5a6c-4415-b0e0-88193b4a379f",
        "name": "Hero",
        "ncContentTypeAlias": "hero",
        "title": "Hero Title Custom Nested Content",
        "subTitle": "Hero subTitle Custom Nested Content",
        "component": []
      }
    ],
    "display": [
      {
        "key": "c172bc9a-14e8-4a78-8567-7a4375bdf469",
        "name": "Html",
        "ncContentTypeAlias": "html",
        "text": "<p>Custom display</p>"
      }
    ]
  }
]]]></Value>
    </layout>
Standard Nested Content
<layout13>
      <Value><![CDATA[[
  {
    "key": "d2327547-8933-4803-ac84-a9c769326c60",
    "name": "Standard",
    "ncContentTypeAlias": "standard",
    "pageHeader": "[\r\n  {\r\n    \"key\": \"21275e98-78c6-4563-933f-4389bfeef470\",\r\n    \"name\": \"Hero\",\r\n    \"ncContentTypeAlias\": \"hero\",\r\n    \"title\": \"Hero Title Standard Nested Content\",\r\n    \"subTitle\": \"Hero subTitle Standard Nested Content\",\r\n    \"component\": []\r\n  }\r\n]",
    "display": "[\r\n  {\r\n    \"key\": \"e073dbe0-9d90-40e7-be69-a4a0141fe236\",\r\n    \"name\": \"Html\",\r\n    \"ncContentTypeAlias\": \"html\",\r\n    \"text\": \"<p>Standard display</p>\"\r\n  }\r\n]"
  }
]]]></Value>
    </layout13>
tbc.