Parses a json document into a pandas object.
496197
def _get_object_parser(self, json):
        
        typ = self.typ
        dtype = self.dtype
        kwargs = {
            "orient": self.orient, "dtype": self.dtype,
            "convert_axes": self.convert_axes,
            "convert_dates": self.convert_dates,
            "keep_default_dates": self.keep_default_dates, "numpy": self.numpy,
            "precise_float": self.precise_float, "date_unit": self.date_unit
        }
        obj = None
        if typ == 'frame':
            obj = FrameParser(json, **kwargs).parse()

        if typ == 'series' or obj is None:
            if not isinstance(dtype, bool):
                kwargs['dtype'] = dtype
            obj = SeriesParser(json, **kwargs).parse()

        return obj
447475
def parse_doc(doc):
    """"""
    if doc is None:
        return {}

    out = {}

    sections = re.split(r'(\w+)\n\s+-{4,50}', doc)  # obj.__doc__.split('\n\n')
    intro = sections.pop(0)
    if intro:
        content = list(map(str.strip, intro.strip().split('\n\n')))
        if len(content) == 1:
            out['title'] = content[0]
        elif len(content) == 2:
            out['title'], out['abstract'] = content

    for i in range(0, len(sections), 2):
        header, content = sections[i:i + 2]

        if header in ['Notes', 'References']:
            out[header.lower()] = content.replace('\n    ', '\n')
        elif header == 'Parameters':
            pass
        elif header == 'Returns':
            match = re.search(r'xarray\.DataArray\s*(.*)', content)
            if match:
                out['long_name'] = match.groups()[0]

    return out
556460
def import_json(cls, filename):
        
        with open(filename, 'rb') as f:
            json_graph = f.read().decode('utf-8')
        return cls.from_json(json_graph)
1255709
def json_conversion(obj):
    """"""
    try:
        # numpy isn't an explicit dependency of bowtie
        # so we can't assume it's available
        import numpy as np
        if isinstance(obj, (np.ndarray, np.generic)):
            return obj.tolist()
    except ImportError:
        pass

    try:
        # pandas isn't an explicit dependency of bowtie
        # so we can't assume it's available
        import pandas as pd
        if isinstance(obj, pd.Index):
            return obj.tolist()
    except ImportError:
        pass

    if isinstance(obj, (datetime, time, date)):
        return obj.isoformat()
    raise TypeError('Not sure how to serialize {} of type {}'.format(obj, type(obj)))
1207041
def loadJson(d):
    """"""
    with codecs.open(jsonFn(d), 'r', 'utf-8') as f:
        return json.load(f)
771232
def from_json(cls, json_doc):
        
        d = json.loads(json_doc)
        token = cls()
        token.__dict__.update(d)
        return token
676073
def from_json(j):
    
    if isinstance(j, dict):
        return from_dict(j)

    if not (isinstance(j, str) or isinstance(j, unicode)):
        raise TypeError("argument must be of type str")

    return from_dict(json.loads(j))
1263315
def load_json(filename, **kwargs):
    

    with open(filename, 'r', encoding='utf-8') as f:
        return json.load(f, **kwargs)
816643
def parse_json(text: str, encoding: str = "utf-8") -> HistogramBase:
    """"""
    data = json.loads(text, encoding=encoding)
    return create_from_dict(data, format_name="JSON")
941476
def parse_json_feed_file(filename: str) -> JSONFeed:
    """"""
    with open(filename) as f:
        try:
            root = json.load(f)
        except json.decoder.JSONDecodeError:
            raise FeedJSONError('Not a valid JSON document')

    return parse_json_feed(root)
749228
def from_json(cls, json_dump):
        
        context = cls()
        if json_dump is None:
            return None
        ctxt = json.loads(json_dump)
        for k in ctxt:
            context[k] = ctxt[k]
        return context
66349
def to_json(df, columns, confidence={}):
        """"""
        records = []

        display_cols = list(columns.keys())
        if not display_cols:
            display_cols = list(df.columns)

        bounds = {}
        for c in confidence:
            bounds[c] = {
                "min": df[confidence[c]["lower"]].min(),
                "max": df[confidence[c]["upper"]].max(),
                "lower": confidence[c]["lower"],
                "upper": confidence[c]["upper"]
            }

        labels = {}
        for c in display_cols:
            if "label" in columns[c]:
                labels[c] = columns[c]["label"]
            else:
                labels[c] = c

        for i, row in df.iterrows():
            row_ = DataTable.format_row(row, bounds, columns)
            records.append({labels[c]: row_[c] for c in display_cols})

        return {
            "data": records,
            "columns": [{"data": labels[c]} for c in display_cols]
        }
659279
def from_json(cls, data, json_schema_class=None):
        
        schema = cls.json_schema if json_schema_class is None else json_schema_class()
        return schema.load(data)
770616
def parse_json_body(req):
    """"""
    content_type = req.headers.get("Content-Type")
    if content_type and core.is_json(content_type):
        try:
            return core.parse_json(req.body)
        except TypeError:
            pass
        except json.JSONDecodeError as e:
            if e.doc == "":
                return core.missing
            else:
                raise
    return {}
29925
def _dict_to_bson(doc, check_keys, opts, top_level=True):
    """"""
    if _raw_document_class(doc):
        return doc.raw
    try:
        elements = []
        if top_level and "_id" in doc:
            elements.append(_name_value_to_bson(b"_id\x00", doc["_id"],
                                                check_keys, opts))
        for (key, value) in iteritems(doc):
            if not top_level or key != "_id":
                elements.append(_element_to_bson(key, value,
                                                 check_keys, opts))
    except AttributeError:
        raise TypeError("encoder expected a mapping type but got: %r" % (doc,))

    encoded = b"".join(elements)
    return _PACK_INT(len(encoded) + 5) + encoded + b"\x00"
53083
def loads(s):
    """"""
    _decoder = json.JSONDecoder()

    while s:
        s = s.strip()
        obj, pos = _decoder.raw_decode(s)
        if not pos:
            raise ValueError('no JSON object found at %i' % pos)
        yield obj
        s = s[pos:]
11617
def parse_json(self, page):
        ''''''
        if not isinstance(page, basestring):
            page = util.decode_page(page)
            
        self.doc = json.loads(page)
        results = self.doc.get(self.result_name, [])
    
        if not results:
            self.check_status(self.doc.get('status'))
            return None
            
            
        return results