VSC MongoDB Playground printjson doesn't work as expected

print(JSON.stringify(…)) works as expected, while printjson is not:

VSC 1.56.2 MacOss
Mongo Extension 0.5.0

1 Like

It’s likely a bug. We are in the process of upgrading the playground runtime, and I’d expect this to go away once we have done that.

As a side note, if you are looking for a way to see the end result of a playground, you don’t need to print it. Just make sure it’s returned in the end and it will be displayed as JSON in an editor.

E.g. a playground like the one below, will result in a code editor that contains the stringified object.

({sampleField: "test"})

If it’s for intermediate results to print in the output panel, then the temporary workaround is to stringify.

2 Likes