How use JSON template in string ?

I want to send

{state:success,value:i} // i is a float, take values from some function

like the JSON template format over TCP server socket, if I don't use the JSON library can I create and send JSON template in string or char array?

Last edited on
std::stringstream stream;
stream << "{\"state\":" << success << ",\"value\":" << value << "}";
std::string json = stream.str();
@helios thank you for replying to my question
Registered users can post here. Sign in or register to post.