Accepts DSON data as a string or as a file object and runs it through the
    JSON parser.

    :rtype: A Python data structure
339808
def render(dson_input, saltenv='base', sls='', **kwargs):
    '''
    
    '''
    if not isinstance(dson_input, six.string_types):
        dson_input = dson_input.read()

    log.debug('DSON input = %s', dson_input)

    if dson_input.startswith('#!'):
        dson_input = dson_input[(dson_input.find('\n') + 1):]
    if not dson_input.strip():
        return {}
    return dson.loads(dson_input)
498813
def from_dict(data):
        
        data = deepcopy(data)

        created_at = data.get('created_at', None)
        if created_at is not None:
            data['created_at'] = dateutil.parser.parse(created_at)

        return Image(**data)
1007384
def from_json(cls, data):
        
        optional_keys = ('city', 'state', 'country', 'latitude', 'longitude',
                         'time_zone', 'elevation', 'station_id', 'source')
        for key in optional_keys:
            if key not in data:
                data[key] = None

        return cls(data['city'], data['state'], data['country'], data['latitude'],
                   data['longitude'], data['time_zone'], data['elevation'],
                   data['station_id'], data['source'])
1275131
def from_json(cls, data):
        
        assert 'header' in data, 'Required keyword "header" is missing!'
        assert 'values' in data, 'Required keyword "values" is missing!'
        return cls(Header.from_json(data['header']), data['values'])
330187
def dumpJSON(self):
        
        g = get_root(self).globals
        dtype = g.observe.rtype()
        if dtype == 'bias':
            target = 'BIAS'
        elif dtype == 'flat':
            target = 'FLAT'
        elif dtype == 'dark':
            target = 'DARK'
        else:
            target = self.target.value()

        return dict(
            target=target,
            ID=self.prog_ob.progid.value(),
            PI=self.pi.value(),
            OB='{:04d}'.format(self.prog_ob.obid.value()),
            Observers=self.observers.value(),
            comment=self.comment.value(),
            flags=dtype,
            filters=self.filter.value()
        )
24004
def parse_obj(o):
    
    r = {}
    for k, v in o.items():
        if is_unable_to_connect(v):
            r[k] = None

        try:
            r[k] = parse_value(k, v)
        except (ObdPidParserUnknownError, AttributeError, TypeError):
            r[k] = None
    return r
927576
def pp_obj(obj, out_path=None, indent=4, sort_keys=False, ensure_ascii=False, default=None):
    
    rt = anyjson.dumps(obj, sort_keys=sort_keys, indent=indent, ensure_ascii=ensure_ascii,
                       separators=(',', ': '), default=default, namedtuple_as_object=False)
    # unicode_available
    if out_path is None:
        return rt
    else:
        with open(out_path, 'w') as out:
            out.write(rt)
475129
def getJsonData(self, params):
        
        try:
            return eval("self." + str(params['output_id']) + "(params)")
        except AttributeError:
            df = self.getData(params)
            if df is None:
                return None
            return df.to_dict(orient='records')
419877
def as_json(obj: JsonObj, indent: Optional[str]='   ', **kwargs) -> str:
    
    return obj._as_json_dumps(indent, **kwargs)
605517
def to_python(self, data):
        
        try:
            return super(OlsrParser, self).to_python(data)
        except ConversionException as e:
            return self._txtinfo_to_jsoninfo(e.data)
1222618
def jsonise(dic):
        """"""
        d = {}
        for k, v in dic.items():
            if type(v) in abstractRequetesSQL.TYPES_PERMIS:
                d[k] = v
            else:
                try:
                    d[k] = json.dumps(v, ensure_ascii=False, cls=formats.JsonEncoder)
                except ValueError as e:
                    logging.exception("Erreur d'encodage JSON !")
                    raise e
        return d
894658
def dump_edn_val(v):
  " "
  if isinstance(v, (str, unicode)): 
    return json.dumps(v)
  elif isinstance(v, E):            
    return unicode(v)
  else:                             
    return dumps(v)
164422
def _make_object_dict(self, obj):
        
        data = {}
        for attr in dir(obj):
            if attr[0] is not '_' and attr is not 'status':
                datum = getattr(obj, attr)
                if not isinstance(datum, types.MethodType):
                    data.update(self._handle_object(attr,datum))
        return data
1237483
def read_dict_from_properties(desired_type: Type[dict], file_object: TextIOBase,
                              logger: Logger, conversion_finder: ConversionFinder, **kwargs) -> Dict[str, Any]:
    

    # right now jprops relies on a byte stream. So we convert back our nicely decoded Text stream to a unicode
    # byte stream ! (urgh)
    class Unicoder:
        def __init__(self, file_object):
            self.f = file_object

        def __iter__(self):
            return self

        def __next__(self):
            line = self.f.__next__()
            return line.encode(encoding='utf-8')

    res = jprops.load_properties(Unicoder(file_object))

    # first automatic conversion of strings > numbers
    res = {key: try_parse_num_and_booleans(val) for key, val in res.items()}

    # further convert if required
    return ConversionFinder.convert_collection_values_according_to_pep(res, desired_type, conversion_finder, logger, 
                                                                       **kwargs)
860793
def json_data(self, instance, default=None):
        
        value = self.get(instance)
        if not value:
            return ""
        if callable(value):
            value = value()
        return api.to_iso_date(value, default=default)
1123195
def json_data(self, instance, default=[]):
        
        value = self.get(instance)
        out = map(api.get_url_info, value)
        return out or default
939631
def from_json(cls, data):
        
        user = cls()

        user.user_id = data['userId']
        user.username = data['username']
        user.auth_system = data['authSystem']
        user.roles = data['roles']

        return user