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
Sure.
1
2
3
std::stringstream stream;
stream << "{\"state\":" << success << ",\"value\":" << value << "}";
std::string json = stream.str();
@helios thank you for replying to my question
Topic archived. No new replies allowed.