def parse_json(data, name='JSON', exception=PluginError, schema=None):
 try:
  json_data = json.loads(data)
 except ValueError as err:
  snippet = repr(data)
  if (len(snippet) > 35):
   snippet = (snippet[:35] + ' ...')
  else:
   snippet = data
  raise exception('Unable to parse {0}: {1} ({2})'.format(name, err, snippet))
 if schema:
  json_data = schema.validate(json_data, name=name, exception=exception)
 return json_data

def parse_json ( data , name = 'JSON' , exception = PluginError , schema = None ) : try : json_data = json . loads ( data ) except ValueError as err : snippet = repr ( data ) if ( len ( snippet ) > 35 ) : snippet = ( snippet [ : 35 ] + ' ...' ) else : snippet = data raise exception ( 'Unable to parse {0}: {1} ({2})' . format ( name , err , snippet ) ) if schema : json_data = schema . validate ( json_data , name = name , exception = exception ) return json_data
converts a json-c string into a jsonc object .