Skip to main content
Version: 11.x

Function: nullSkipReplacer()

nullSkipReplacer(key, value): any

Defined in: src/utils/hash/classHash/cairo0.ts:26

JSON replacer function that skips null values and empty arrays for specific keys Used in legacy contract class serialization

Parameters​

key​

string

value​

any

Returns​

any

Example​

const input = { a: null, attributes: [], debug_info: { x: 1 }, b: 2 };
const result = JSON.stringify(input, hash.nullSkipReplacer);
// result = '{"debug_info":null,"b":2}'