implementing JSON Document as pointer in sqlite callbackfunction

hello guys,
I am working on a sqlite database project based on siara_library
As I am working with JSON v6 to get process data from database further I now want to save the requested data within the callbackfunction into a JSON Object and pass that back to the main function.
The library offers a void*data parameter pointer that can be used to pass anything to the callback function.
I am completely new to pointers and would kindly ask your help.
here is my code so far:

#include <ArduinoJson.h>
#include <stdio.h>
#include <stdlib.h>
#include <sqlite3.h>
#include <SPI.h>
#include <FS.h>
#include "SPIFFS.h"

static int callback(void *data, int argc, char **argv, char **azColName) {
//I need to use *data for filling a JSON Object-->but how???
   int i;
   for (i = 0; i<argc; i++){
       Serial.printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
   }
   Serial.printf("\n");
   return 0;
}

int db_open(const char *filename, sqlite3 **db) {
   int rc = sqlite3_open(filename, db);
   if (rc) {
       Serial.printf("Can't open database: %s\n", sqlite3_errmsg(*db));
       return rc;
   } else {
       Serial.printf("Opened database successfully\n");
   }
   return rc;
}

char *zErrMsg = 0;
int db_exec(sqlite3 *db, const char *sql) {
  DynamicJsonDocument doc(1024);
  JsonObject data=doc.createNestedObject();
   Serial.println(sql);
   long start = micros();
   int rc = sqlite3_exec(db, sql, callback, &data, &zErrMsg);//JSON Object needs to be passed to callbackfunctino but how???
   if (rc != SQLITE_OK) {
       Serial.printf("SQL error: %s\n", zErrMsg);
       sqlite3_free(zErrMsg);
   } else {
       Serial.printf("Operation done successfully\n");
       serializeJson(data,Serial);
       free(data);
   }
   Serial.print(F("Time taken:"));
   Serial.println(micros()-start);
   return rc;
}

void setup() {

   Serial.begin(115200);
   sqlite3 *db1;
 
   int rc;

   if (!SPIFFS.begin()) {
       Serial.println("Failed to mount file system");
       return;
   }

   
   sqlite3_initialize();

   if (db_open("/spiffs/lightsaber.db", &db1))
       return;
 

   rc = db_exec(db1, "select id,name from profiles");
   if (rc != SQLITE_OK) {
       sqlite3_close(db1);
     
       return;
   }
 
   sqlite3_close(db1);

}

void loop() {
}