@@ -303,10 +303,10 @@ def _object_to_awkward_json(form, obj):
303303 return out
304304
305305 elif form ["class" ][:15 ] == "ListOffsetArray" :
306- if form [ "parameters" ] .get ("__array__" ) == "string" :
306+ if form . get ( "parameters" , {}) .get ("__array__" ) == "string" :
307307 return obj
308308
309- elif form ["content" ][ "parameters" ] .get ("__array__" ) == "sorted_map" :
309+ elif form ["content" ]. get ( "parameters" , {}) .get ("__array__" ) == "sorted_map" :
310310 key_form = form ["content" ]["contents" ][0 ]
311311 value_form = form ["content" ]["contents" ][1 ]
312312 return [
@@ -385,30 +385,30 @@ def _awkward_json_to_array(awkward, form, array):
385385 names .append (name )
386386 length = len (array ) if len (contents ) == 0 else None
387387 return awkward .contents .RecordArray (
388- contents , names , length , parameters = form [ "parameters" ]
388+ contents , names , length , parameters = form . get ( "parameters" , {})
389389 )
390390
391391 elif form ["class" ][:15 ] == "ListOffsetArray" :
392- if form [ "parameters" ] .get ("__array__" ) == "string" :
392+ if form . get ( "parameters" , {}) .get ("__array__" ) == "string" :
393393 if isinstance (array , awkward .contents .EmptyArray ):
394394 content = awkward .contents .NumpyArray (
395395 numpy .empty (0 , dtype = numpy .uint8 ),
396- parameters = form ["content" ][ "parameters" ] ,
396+ parameters = form ["content" ]. get ( "parameters" , {}) ,
397397 )
398398 return awkward .contents .ListOffsetArray (
399399 awkward .index .Index64 (numpy .array ([0 ], dtype = numpy .uint8 )),
400400 content ,
401- parameters = form [ "parameters" ] ,
401+ parameters = form . get ( "parameters" , {}) ,
402402 )
403403 else :
404404 content = _awkward_json_to_array (
405405 awkward , form ["content" ], array .content
406406 )
407407 return type (array )(
408- array .offsets , content , parameters = form [ "parameters" ]
408+ array .offsets , content , parameters = form . get ( "parameters" , {})
409409 )
410410
411- elif form ["content" ][ "parameters" ] .get ("__array__" ) == "sorted_map" :
411+ elif form ["content" ]. get ( "parameters" , {}) .get ("__array__" ) == "sorted_map" :
412412 offsets = _awkward_offsets (awkward , form , array )
413413 key_form = form ["content" ]["contents" ][0 ]
414414 value_form = form ["content" ]["contents" ][1 ]
@@ -419,7 +419,7 @@ def _awkward_json_to_array(awkward, form, array):
419419 (keys , values ),
420420 None ,
421421 0 ,
422- parameters = form ["content" ][ "parameters" ] ,
422+ parameters = form ["content" ]. get ( "parameters" , {}) ,
423423 )
424424 else :
425425 keys = _awkward_json_to_array (awkward , key_form , array .content ["0" ])
@@ -429,10 +429,10 @@ def _awkward_json_to_array(awkward, form, array):
429429 (keys , values ),
430430 None ,
431431 length ,
432- parameters = form ["content" ][ "parameters" ] ,
432+ parameters = form ["content" ]. get ( "parameters" , {}) ,
433433 )
434434 cls = uproot ._util ._content_cls_from_name (awkward , form ["class" ])
435- return cls (offsets , content , parameters = form [ "parameters" ] )
435+ return cls (offsets , content , parameters = form . get ( "parameters" , {}) )
436436
437437 else :
438438 offsets = _awkward_offsets (awkward , form , array )
@@ -443,15 +443,15 @@ def _awkward_json_to_array(awkward, form, array):
443443 awkward , form ["content" ], array .content
444444 )
445445 cls = uproot ._util ._content_cls_from_name (awkward , form ["class" ])
446- return cls (offsets , content , parameters = form [ "parameters" ] )
446+ return cls (offsets , content , parameters = form . get ( "parameters" , {}) )
447447
448448 elif form ["class" ] == "RegularArray" :
449449 if isinstance (array , awkward .contents .EmptyArray ):
450450 content = _awkward_json_to_array (awkward , form ["content" ], array )
451451 else :
452452 content = _awkward_json_to_array (awkward , form ["content" ], array .content )
453453 return awkward .contents .RegularArray (
454- content , form ["size" ], parameters = form [ "parameters" ]
454+ content , form ["size" ], parameters = form . get ( "parameters" , {})
455455 )
456456
457457 else :
0 commit comments