Changed parser to use bit flags for number handling, added more exception handling for invalid json.