function ctx_to_json(ctx, size = 0) {
    let chunk = [],
        json = [];

    if (size) {
        size = 0 | chunk_size_ctx * (chunk_size_reg / size);
    }
    for (const item of ctx.entries()) {
        const key = item[0],
              value = item[1];

        json.push([key, map_to_json(value)[0]]);
        if (json.length === size) {
            chunk.push(json);
            json = [];
        }
    }
    json.length && chunk.push(json);
    return chunk;
}
@param {Map<Map<IntermediateSearchResults>>|KeystoreMap<KeystoreMap<IntermediateSearchResults>>} ctx
@param {number=} size
@return {Array<Object>}