added pre-checks for null
use JSON tokenizer