JSFiddle - React, Tailwind, and code Playground

JavaScript

function convert(d) {
    var r = {}, j = 0;
    for (var i in d) {
        r['row' + (j++)] = flatten({
            key1: i
        }, d[i], 2);
    }
    return r;
}

function flatten(r, d, l) {
    for (var i in d) {
        var c = d[i];
        if (c && typeof c == 'object') {
            r['key' + l] = i;
            flatten(r, c, l + 1);
        } else {
            r[i] = c;
        }
    }
    return r;
}

alert(JSON.stringify(convert({
    'somePage1': {
        0: {
            'function2': 'getPrice',
            item: '0568000085',
            line: 6
        },
        1: {
            'function2': 'getCurrency',
            item: '066000089',
            line: 9
        }
    },
    'somePage2': {
        0: {
            'function2': 'getPrice',
            item: '0568000085',
            line: 6
        },
        1: {
            'function2': 'getCurrency',
            item: '066000089',
            line: 9
        }
    },
    'somePage3': {
        0: {
            'function2': 'getPrice',
            item: '0568000085',
            line: 6
        },
        1: {
            'function2': 'getCurrency',
            item: '066000089',
            line: 9
        }
    },
    'somePage4': {
        0: {
            'function2': 'getPrice',
            item: '0568000085',
            line: 6
        },
        1: {
            'function2': 'getCurrency',
            item: '066000089',
            line: 9
        }
    }

})))