How Do You Know if Your Logging is Truly in JSON Format or Not?

Problem scenario
You are not sure if you have valid JSON or not. You have converted raw logs of an application to be in JSON format. There is a flat file receiving what you believe to be valid JSON. How do you know for sure?

Solution
Put the JSON in here https://jsonformatter.curiousconcept.com/ and click "Process".

The JSON should start with an opening brace { and end with a closing brace }. The final element should not have a comma. You can copy some JSON and put it inside two braces {} and remove the final comma (if any exists) from your logs, text or file you are creating. Then above website will tell you if you have valid JSON.

Leave a comment

Your email address will not be published. Required fields are marked *