title: How to Validate JSON Syntax Using a Character Stack in Java?
body: <p>I have an input file ("student.json") that consists of a few lines of JSON code such as: </p>
  
  <pre><code>{"name":"Josh","age":22,"gender":"M"} 
  </code></pre>
  
  <p>that will be used in a Java program. The program should input the file, grab a JSON string, and then use a character stack to validate the syntax (the program should ignore what the specific property [name] and value [Josh] is, but know that each set of braces MUST have at least 2 values with a colon between). If the syntax is correct the console will tell the user that the JSON string is valid, if it is not valid the console will say so. </p>
  
  <p>For the character stack I am to loop through each character of the JSON string. When an opening brace or bracket is encountered the program should push it on the stack. When a closing brace or bracket is encountered the program should then pop a value off the stack and see if it matches. I am also supposed to use the isEmpty method to see if there are unmatched symbols.</p>
  
  <p>I have never used a character stack before. I know how to do the rest of the Java program, it is just the stack I am stuck on. </p>
  
  <p>Question: How do I validate the JSON string using this character stack and the requirements? </p>