JSFiddle - React, Tailwind, and code Playground

HTML

<canvas id="c"></canvas>

JavaScript

// make stuff
canvas = new fabric.Canvas('c', {
    backgroundColor: '#bbb'
});

rect1 = new fabric.Rect({
    width: 20,
    height: 20,
    fill: '#eee'
});

text1 = new fabric.Text("example text", {
    fontSize: 20
});

var group = new fabric.Group([rect1,text1],{
        top:20,
        left:20
});

canvas.add(group);

// the fun part!
var objsInCanvas = canvas.getObjects();

for (obj in objsInCanvas) {
    // this gives you a group
    if(objsInCanvas[obj].get('type')==='group') {
        // get all the objects in a group
        var groupObjects = objsInCanvas[obj].getObjects();
        // iterate through the group
        for (thing in groupObjects) {
            // grab the text of any 'text' objects
            if(groupObjects[thing].get('type')===('text')) {
                // 'example text' is logged in console
                console.log(groupObjects[thing].getText());
            }
        };
    }
};