It is important to note that this function can only succeed on stream file descriptors (such as SOCK_STREAM). Using this function on a non-stream file descriptor will result in undefined behavior. For non-stream file descriptors, see instead json_loadb(). In addition, please note that this function cannot be used on non-blocking file descriptors (such as a non-blocking socket). Using this function on non-blocking file descriptors has a high risk of data loss because it does not support resuming.
So this one is no-go.
json_load_callback_t
On success, the function should write at most buflen bytes to buffer, and return the number of bytes written; a returned value of 0 indicates that no data was produced and that the end of file has been reached. On error, the function should return (size_t)-1 to abort the decoding process.
But I want to keep the context, so this cannot work either.
From the documentation:
So this one is no-go.
But I want to keep the context, so this cannot work either.
I guess it is not possible to do this, or is it?