Handle invalid JSON data for mapping.

Also: allow some number of map errors before aborting.

cbugg: close bug-496