Cast from uint8_t* to char - loses precision I am trying to decode a received (via websocket) message (JSON) on my ESP8266.

The websocket library provides the data as uint8_t. The JSON library only understands char arrays. As far as I know uint8_t is basically char.

I am getting this error:
cast from 'uint8_t* {aka unsigned char*}' to 'char' loses precision [-fpermissive]

The websocket-function provides the payload as uint8_t:

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


The JSON Decoder wants a char arr, as provides in the sample:

char json[] =
"{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}";


How to "convert" the uint8_t to char[]?

Here is my full code:

#include &lt;ArduinoJson.h&gt;
#include &lt;ESP8266WiFi.h&gt;
#include &lt;WebSocketsServer.h&gt;

WebSocketsServer webSocket = WebSocketsServer(81);
StaticJsonBuffer&lt;200&gt; jsonBuffer;



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

    switch(type) {
        case WStype_DISCONNECTED:
            Serial.printf("[%u] Disconnected!\n", num);
            break;
        case WStype_CONNECTED:
            {
                IPAddress ip = webSocket.remoteIP(num);
                Serial.printf("[%u] Connected from %d.%d.%d.%d url: %s\n", num, ip[0], ip[1], ip[2], ip[3], payload);

        // send message to client
        webSocket.sendTXT(num, "Connected");
            }
            break;
        case WStype_TEXT:
        {
            Serial.printf("[%u] get Text: %s\n", num, payload);
            JsonObject&amp; root = jsonBuffer.parseObject((char)payload);
            // send message to client
            // webSocket.sendTXT(num, "message here");

            // send data to all connected clients
            // webSocket.broadcastTXT("message here");
        }
            break;
        case WStype_BIN:
            Serial.printf("[%u] get binary length: %u\n", num, length);
            hexdump(payload, length);

            // send message to client
            // webSocket.sendBIN(num, payload, length);
            break;
    }

}


void setup()
{
  Serial.begin(115200);
  Serial.println();
  IPAddress ip(192, 168, 178, 51);
  IPAddress gateway(192, 168, 178, 1);
  IPAddress subnet(255, 255, 255, 0);
  WiFi.config(ip, gateway, subnet);
  WiFi.begin("MyWifi!", "passpasspass");

  Serial.print("Connecting");
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println();

  Serial.print("Connected, IP address: ");
  Serial.println(WiFi.localIP());
  webSocket.begin();
  webSocket.onEvent(webSocketEvent);
}

void loop() {
   webSocket.loop();
  }
Well, you are trying to cast pointer to uint8_t to one character, so it warns you about that. If you cast it to pointer to char, it should work:

JsonObject&amp; root = jsonBuffer.parseObject((char *)payload);