def read_json(cls,
                  url,
                  orient='records'):
        """
        Reads a JSON file representing a table into an SFrame.

        Parameters
        ----------
        url : string
            Location of the CSV file or directory to load. If URL is a directory
            or a "glob" pattern, all matching files will be loaded.

        orient : string, optional. Either "records" or "lines"
            If orient="records" the file is expected to contain a single JSON
            array, where each array element is a dictionary. If orient="lines",
            the file is expected to contain a JSON element per line.

        Examples
        --------
        The orient parameter describes the expected input format of the JSON
        file.

        If orient="records", the JSON file is expected to contain a single
        JSON Array where each array element is a dictionary describing the row.
        For instance:

        >>> !cat input.json
        [{'a':1,'b':1}, {'a':2,'b':2}, {'a':3,'b':3}]
        >>> SFrame.read_json('input.json', orient='records')
        Columns:
                a	int
                b	int
        Rows: 3
        Data:
        +---+---+
        | a | b |
        +---+---+
        | 1 | 1 |
        | 2 | 2 |
        | 3 | 3 |
        +---+---+

        If orient="lines", the JSON file is expected to contain a JSON element
        per line. If each line contains a dictionary, it is automatically
        unpacked.

        >>> !cat input.json
        {'a':1,'b':1}
        {'a':2,'b':2}
        {'a':3,'b':3}
        >>> g = SFrame.read_json('input.json', orient='lines')
        Columns:
                a	int
                b	int
        Rows: 3
        Data:
        +---+---+
        | a | b |
        +---+---+
        | 1 | 1 |
        | 2 | 2 |
        | 3 | 3 |
        +---+---+

        If the lines are not dictionaries, the original format is maintained.

        >>> !cat input.json
        ['a','b','c']
        ['d','e','f']
        ['g','h','i']
        [1,2,3]
        >>> g = SFrame.read_json('input.json', orient='lines')
        Columns:
                X1	list
        Rows: 3
        Data:
        +-----------+
        |     X1    |
        +-----------+
        | [a, b, c] |
        | [d, e, f] |
        | [g, h, i] |
        +-----------+
        [3 rows x 1 columns]
        """
        if orient == "records":
            g = SArray.read_json(url)
            if len(g) == 0:
                return SFrame()
            g = SFrame({'X1':g})
            return g.unpack('X1','')
        elif orient == "lines":
            g = cls.read_csv(url, header=False,na_values=['null'],true_values=['true'],false_values=['false'], 
                    _only_raw_string_substitutions=True)
            if g.num_rows() == 0:
                return SFrame()
            if g.num_columns() != 1:
                raise RuntimeError("Input JSON not of expected format")
            if g['X1'].dtype == dict:
                return g.unpack('X1','')
            else:
                return g
        else:
            raise ValueError("Invalid value for orient parameter (" + str(orient) + ")")
Reads a JSON file representing a table into an SFrame.

        Parameters
        ----------
        url : string
            Location of the CSV file or directory to load. If URL is a directory
            or a "glob" pattern, all matching files will be loaded.

        orient : string, optional. Either "records" or "lines"
            If orient="records" the file is expected to contain a single JSON
            array, where each array element is a dictionary. If orient="lines",
            the file is expected to contain a JSON element per line.

        Examples
        --------
        The orient parameter describes the expected input format of the JSON
        file.

        If orient="records", the JSON file is expected to contain a single
        JSON Array where each array element is a dictionary describing the row.
        For instance:

        >>> !cat input.json
        [{'a':1,'b':1}, {'a':2,'b':2}, {'a':3,'b':3}]
        >>> SFrame.read_json('input.json', orient='records')
        Columns:
                a	int
                b	int
        Rows: 3
        Data:
        +---+---+
        | a | b |
        +---+---+
        | 1 | 1 |
        | 2 | 2 |
        | 3 | 3 |
        +---+---+

        If orient="lines", the JSON file is expected to contain a JSON element
        per line. If each line contains a dictionary, it is automatically
        unpacked.

        >>> !cat input.json
        {'a':1,'b':1}
        {'a':2,'b':2}
        {'a':3,'b':3}
        >>> g = SFrame.read_json('input.json', orient='lines')
        Columns:
                a	int
                b	int
        Rows: 3
        Data:
        +---+---+
        | a | b |
        +---+---+
        | 1 | 1 |
        | 2 | 2 |
        | 3 | 3 |
        +---+---+

        If the lines are not dictionaries, the original format is maintained.

        >>> !cat input.json
        ['a','b','c']
        ['d','e','f']
        ['g','h','i']
        [1,2,3]
        >>> g = SFrame.read_json('input.json', orient='lines')
        Columns:
                X1	list
        Rows: 3
        Data:
        +-----------+
        |     X1    |
        +-----------+
        | [a, b, c] |
        | [d, e, f] |
        | [g, h, i] |
        +-----------+
        [3 rows x 1 columns]