score:0

Accepted answer
const yourData = [{
    "2671161009": {
        "activityType": "RUNNING",
        "averageHeartRateInBeatsPerMinute": 134,
        "comments": "",
        "durationInSeconds": 3884,
        "startTimeInSeconds": 1525368621,
        "startTimeOffsetInSeconds": -14400,
        "summaryId": "2671161009",
    },
    "2671161249": {
        "activityType": "OTHER",
        "averageHeartRateInBeatsPerMinute": 111,
        "comments": "",
        "durationInSeconds": 103,
        "startTimeInSeconds": 1525372533,
        "startTimeOffsetInSeconds": -14400,
        "summaryId": "2671161249",
    },
}];

const activityData = yourData[0];// You have the entire object as the first element in an array. I don't know why;

const activityIds = Object.keys(activityData);
const activities = activityIds.map(activityID => ({
    id: activityID,
    ...activityData[activityID]
}));

You can now map this activities array as you wish.

score:0

hey how about a one liner code

Object.entries(b[0]).map((item , index)=>
 <tr key={index}>
        <td>Activity Type: {item[1].activityType}</td>
        <td>DurationInSeconds: {item[1].durationInSeconds}</td>
  </tr>
)

in Object.entries(b[0]) you will get your entries in an array then loop that array as your wish

score:3

You can use Object.entries to access all key-value pairs of the object:

<div>
  {arr.map(obj =>
    Object.entries(obj).map(([key, value]) => (
      <tr key={key}>
        <td>Key: {key}</td>
        <td>Activity Type: {value.activityType}</td>
        <td>DurationInSeconds: {value.durationInSeconds}</td>
      </tr>
    )))}
</div>

Related Query

More Query from same tag