Error with JSON as function argument: error: cannot convert 'uint8_t*' {aka 'unsigned char*'} to 'uint8_t' {aka 'unsigned char'}

Hey!
I've encountered a problem when trying to pass a response from a WebSocket server to a JSON serialising function.
It receives an error:
src/main.cpp:46:18: error: cannot convert 'uint8_t*' {aka 'unsigned char*'} to 'uint8_t' {aka 'unsigned char'}
What is wrong?

void readJSONData(uint8_t JSONInput)
{
  DynamicJsonDocument doc(1024);
}

void webSocketEvent(WStype_t type, uint8_t *payload, size_t length)
{

  switch (type)
  {
  case WStype_DISCONNECTED:
    USE_SERIAL.printf("[WSc] Disconnected!");
    break;
  case WStype_CONNECTED:
    USE_SERIAL.printf("[WSc] Connected to url: %s\n", payload);
    break;
  case WStype_TEXT:
    USE_SERIAL.printf("[WSc] get text: %s\n", payload);

    readJSONData(payload);
    break;
  case WStype_BIN:
    USE_SERIAL.printf("[WSc] get binary length: %u\n", length);
    break;
  case WStype_ERROR:
  case WStype_FRAGMENT_TEXT_START:
  case WStype_FRAGMENT_BIN_START:
  case WStype_FRAGMENT:
  case WStype_FRAGMENT_FIN:
  case WStype_PING:
  case WStype_PONG:
    break;
  }
}

Maybe

void readJSONData(uint8_t* JSONInput)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.