Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stringify objects #300

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Stringify objects #300

wants to merge 5 commits into from

Conversation

slayer
Copy link

@slayer slayer commented Aug 10, 2018

Currently objects displayed as [object Object]

for example, for event {message: "blabla", meta: {ip: "1.2.3.4", user_id: 123}} and format "{{message}} {{meta}}"
Result will be "blabla [object Object]"

This PR adds helper to display objects as JSON:
"{{message}} {{json meta}}"
Result will be "blabla {ip: "1.2.3.4", user_id: 123}"

@sivasamyk
Copy link
Owner

Thanks for the PR! Can't you directly map the json fields in handlebar like {{{meta.ip}}}? Are the fields in meta dynamic? If so, won't it be useful if we prettify the json using JSON.stringify(context, null, 2);?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants