Jovo Output Object
Learn more about the Jovo $output
object.
Introduction
The Jovo $output
is a consolidated JSON object that is prepared during routing, and later turned into a response in the output
Middleware.
You can access the object like this:
If you log it after calling the tell
method:
The logs for the $output
object look like this:
And the generated response would be the following:
If you are reading the logs returned from the server (e.g. AWS CloudWatch), you can use the JSON.stringify()
method to turn the object into a human-readable JSON string response:
Output Structure
The $output
object can contain elements for tell
, ask
, as well visual and plaform-specific output.
For example, it looks like this after ask
:
Output Middleware
The output
middleware is used to turn the $output
object into a $response
object, as shown in the Introduction above.
The middleware turns the cross-platform output into platform-specific JSON responses based on the platform the framework is currently interacting with. This is why the $output
object is helpful for Hooks and Plugins, as they then only need to worry about the abstracted object, not any possible response JSON structure.