{"record":{"id":"4681cc6b15435bfc","repo":"abpframework/abp","slug":"json-value-is-not-an-array-of-objects-value","errorCode":null,"errorMessage":"JSON value is not an array of objects: {value}","messagePattern":"JSON value is not an array of objects: (.+?)","errorType":"exception","errorClass":"AbpException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Core/Volo/Abp/SimpleStateChecking/SimpleStateCheckerSerializerExtensions.cs","lineNumber":81,"sourceCode":"        where TState : IHasSimpleStateCheckers<TState>\n    {\n        if (value.IsNullOrWhiteSpace())\n        {\n            return Array.Empty<ISimpleStateChecker<TState>>();\n        }\n        \n        var array = JsonNode.Parse(value) as JsonArray;\n        if (array == null || array.Count == 0)\n        {\n            return Array.Empty<ISimpleStateChecker<TState>>();\n        }\n        \n        if (array.Count == 1)\n        {\n            var jsonObject = array[0] as JsonObject;\n            if (jsonObject == null)\n            {\n                throw new AbpException(\"JSON value is not an array of objects: \" + value);\n            }\n\n            var checker = serializer.Deserialize(jsonObject, state);\n            if (checker == null)\n            {\n                return Array.Empty<ISimpleStateChecker<TState>>();\n            }\n            \n            return new[] { checker };\n        }\n\n        var checkers = new List<ISimpleStateChecker<TState>?>();\n\n        for (var i = 0; i < array.Count; i++)\n        {\n            if (array[i] is not JsonObject jsonObject)\n            {\n                throw new AbpException(\"JSON value is not an array of objects: \" + value);","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Core/Volo/Abp/SimpleStateChecking/SimpleStateCheckerSerializerExtensions.cs#L63-L99","documentation":"Thrown by SimpleStateCheckerSerializerExtensions.DeserializeArray when the parsed JSON is a one-element (or multi-element) array but an element is not a JsonObject — i.e. the array holds a primitive/array instead of an object. It is an AbpException echoing the offending value. It indicates malformed persisted state-checker data.","triggerScenarios":"Calling DeserializeArray(stateCheckersJson, state) where the JSON is like [\"foo\"] or [[...]] instead of [{\"Name\":\"...\",...}].","commonSituations":"Corrupted persisted simple-state-checker data (DB column, cache entry), a schema change between ABP versions that altered the serialized shape, or hand-edited/migrated data that is not a JSON object array.","solutions":["Re-serialize the state checkers via the Serialize extension to get a valid JSON-object array, then persist that.","Clear/reset the corrupted persisted state-checker value so it regenerates.","After an ABP upgrade, run any provided migration for persisted state-checker data or re-save the entities.","Validate the stored JSON shape before calling DeserializeArray (parse and assert each element is a JsonObject)."],"exampleFix":"// before\n// persisted value: [\"MyChecker\"]  (malformed)\nvar checkers = serializer.DeserializeArray(storedJson, state);\n\n// after\n// persisted value: [{\"Name\":\"MyChecker\",\"IsGlobal\":false}]\nvar checkers = serializer.DeserializeArray(storedJson, state);","handlingStrategy":"validation","validationCode":"static bool IsValidCheckerJson(string value)\n{\n    if (value.IsNullOrWhiteSpace()) return true;\n    var arr = JsonNode.Parse(value) as JsonArray;\n    return arr is null || arr.All(e => e is JsonObject);\n}\n\nif (!IsValidCheckerJson(storedJson)) { /* reset/regenerate */ }","typeGuard":"static bool IsJsonObjectArray(JsonNode? node)\n    => node is JsonArray arr && arr.All(e => e is JsonObject);","tryCatchPattern":"try { var checkers = serializer.DeserializeArray(storedJson, state); }\ncatch (AbpException ex) when (ex.Message.Contains(\"not an array of objects\"))\n{\n    logger.LogWarning(ex, \"Corrupted state-checker data; resetting\");\n    storedJson = null; // regenerate\n}","preventionTips":["Always persist state-checker data via the Serialize extension, never hand-built JSON.","After ABP upgrades, re-save or migrate persisted state-checker columns.","Validate the stored JSON shape before deserializing in production."],"tags":["serialization","state-checking","json","data-corruption","abp-core"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}