fix mistake in example code
move JSON.parse code into lib
correct FIXME comment