This question is independent of implementation language.
In a recent interview I was asked to write a JSON parser : The input I was given was something like below:
{
'key1': 'value1',
'key2': [key21, key22]
}
As simple as it may sound, I was stumped as I did not know how to write the parser (btw I am aware of JSON.parse() methods).
The question was to write your own parser.
It matters little that the above JSON is not in the right format. The parse should throw an error if it is not.
Can someone point me towards some technique I could have used to solve this problem.