Is it possible to encode a C char array (char*) in JSON in order to send it through a TCP socket? If so how can I make it and which would be a simple JSON library to use?
Thanks,
Is it possible to encode a C char array (char*) in JSON in order to send it through a TCP socket? If so how can I make it and which would be a simple JSON library to use?
Thanks,
Copyright © 2021 Jogjafile Inc.
You probably don't need to use JSON. If you just want to send a simple message (e.g. "Hi, how are ya"), then you can just send the char array. You cannot send JSON, only a char array of JSON (JSON is a data format, not a transfer protocol).
Example
If you need to serialize a struct into a JSON string, I would recommend this.