json::encode()
Convert value to a JSON string
json::encode(value, indent = -1, indent_char = " ")
value (object) — An object to be encodedindent (number, optional) — If indent > 0, then JSON string will be prettified with that indent level. If indent is -1, then the most compact JSON string is returned. If indent is 0, then no indentation. The default value is -1indent_char (string, optional) — The character to be used for indentation. The default value is " "
string — A JSON string
request = json.encode({
"id": "A23",
"name": "Clara",
"age": 23
})