Skip to content

send_json()

send_json() is a macro for sending application/json responses easily. It runs reply() function under the hood.

#include "ecewo.h"
void hello_world(Req *req, Res *res)
{
send_json(200, "{ \"message\": \"hello world!\" }");
}

You can generate and parse JSON objects via built-in cJSON. See Using JSON chapter.