bson: add max recursion check in bson_as_json().