The error

request for member 'write' in '...::Writer<char*, void>::_dest', which is of non-class type 'char*'

The compiler looked for a member function called write() in the type char*, meaning it confused a char pointer for a custom writer class.

When does it occur?

This error occurs when you pass a char* to serializeJson() but forget to pass the third argument. For example:

serializeJson(doc, ptr);  // request for member 'write' in ..., which is of non-class type 'char*' 

How to fix it?

To fix this error, you must pass the size of the destination buffer as the third argument, like so:

serializeJson(doc, ptr, size);  // OK

When can I omit the third argument?

In the examples, you may have seen that I didn’t use the size argument; that’s because the second argument was not a char* but a char[N], and serializeJson() was able to infer the value of N from the type.

 X online