Formatting the jsonPayload of a Wix Log entry like...well, JSON

Does anyone know how to format the information passed to logging (for example via console.info) so that JSON objects can be readable in the Wix Log viewer JSON panel? Right now everything is mashed together and I need to copy it out, remove the escaped quotes, and then paste it into a JSON formatting tool. It seems there should be a way to do this so I can just use the native Wix viewer since it is already a JSON viewer.

Hey! I shared this feedback with the team, and they have a potential fix. Would you be able to share an example payload of your JSON that they can run a few tests with to ensure they’ve understood correctly and the fix will be accurate for your use case :slight_smile:

Hey! Just looping around that the team pushed a fix today that means that when doing console.log with just JSON, it will stay formatted as JSON, so you no longer need to remove escaped quotes etc :slight_smile:

Hi Noah. Thank you for responding. In trying to send you a sample I realized this was “user error” (i.e. I’m the idiot). I was logging using the following code:

console.info( “Current member”, member );

This results in the jsonPayload looking like a regular string because it is a regular string.

When I changed it to:

console.info( { msg: “Current member”, member } );

The jsonPayload is JSON and shows appropriately in the log viewer. My apologies!

All good! And you’re not mistaken :slight_smile:

Previous to todays fix, this would also have been formatted as a string. Passing JSON to the console.log, now keeps it as JSON - which is definitely a better experience.

Thanks for raising it :raising_hands: