mapResponse

mapResponse is a utility function that transforms raw Notion API responses into simplified, developer-friendly JavaScript objects.
It recursively maps pages, databases, and blocks, extracting only the most relevant fields and values.

Parameters

Name Type Description
notionResponse object The raw response object from the Notion API (page, database, block, or list).

Returns

A simplified JavaScript object (or array of objects) representing the Notion entity.
The structure depends on the input type (page, database, block, or list).

Example

import { mapResponse } from 'notionbridge/extras/responseMapping';

const raw = await fetchNotionApiSomehow();
const mapped = mapResponse(raw);
console.log(mapped);

Mapping Behavior

Notes

Example Response

{
  "id": "abc123",
  "url": "https://www.notion.so/abc123",
  "Name": "Demo",
  "Status": "In Progress"
}