-
Notifications
You must be signed in to change notification settings - Fork 883
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
asJson() method doesn't return a valid JSON if mergingObject key contains a double quote #1767
Comments
Looks like a bug that needs fixing! Good spot! |
Hi @mcollina |
Given that none of the maintainers have ever encountered this issue, it's unlikely to be on our priority list. We would be eager to review any PR that solves it, though. |
I create this pull request. |
I added the issue now (updated my comment on pr) since I realized this issue can probably be closed. Sorry didn't initially include it |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
In case key(s) of the mergingObject contains
"
symbol, it is not getting shielded. So, logged object is not a valid JSON string.See code example:
This will result in the log below:
{"level":30,"time":1690897379299,"pid":41644,"hostname":"your-hostname","some"prop":{"details":true}}
I'm using newrelic to collect logs and it relies on asJson() method. Due to an invalid JSON is returned, JSON.parse throws an error.
Please see details here newrelic/node-newrelic#1744.
Please confirm whether this is an expected log format or it should be fixed.
From methods name
asJson()
I'd expect it to return a valid JSON string.The text was updated successfully, but these errors were encountered: