def _append_json_callback(option, opt_str, value, parser):
 _default_to(parser, option.dest, [])
 try:
  j = json.loads(value)
 except ValueError as e:
  parser.error(('Malformed JSON passed to %s: %s' % (opt_str, str(e))))
 getattr(parser.values, option.dest).append(j)

def _append_json_callback ( option , opt_str , value , parser ) : _default_to ( parser , option . dest , [ ] ) try : j = json . loads ( value ) except ValueError as e : parser . error ( ( 'Malformed JSON passed to %s: %s' % ( opt_str , str ( e ) ) ) ) getattr ( parser . values , option . dest ) . append ( j )
callback to parse json and append it to a list .