A view that renders structured JSON and returns "application/json" content type. More...
#include <JsonView.h>
Public Member Functions | |
JsonView (const nlohmann::json &payload) | |
std::string | render (const std::map< std::string, std::string > &context={}) const override |
Render the view body. | |
std::string | getContentType () const override |
Return the MIME content type for this view. | |
![]() | |
virtual | ~FrameworkView ()=default |
virtual void | applyHeaders (HttpResponse &response) const |
Optional hook to set response headers (e.g., Content-Disposition). | |
virtual std::string | render (const nlohmann::json &context) const |
Optional JSON context hook (used by JsonView or convenience). | |
Private Attributes | |
nlohmann::json | payload_ |
Definition at line 20 of file JsonView.h.
|
explicit |
Definition at line 14 of file JsonView.cpp.
|
overridevirtual |
Implements FrameworkView.
Definition at line 22 of file JsonView.cpp.
|
overridevirtual |
Optional context (used by templates).
Implements FrameworkView.
Definition at line 17 of file JsonView.cpp.
References payload_.
|
private |
Definition at line 28 of file JsonView.h.
Referenced by render().