StringMethods.get_json_object(json_path, *, allow_single_quotes=False, strip_quotes_from_single_strings=True, missing_fields_as_nulls=False)[source]#

Applies a JSONPath string to an input strings column where each row in the column is a valid json string


The JSONPath string to be applied to each row of the input column

allow_single_quotesbool, default False

If True, representing strings with single quotes is allowed. If False, strings must only be represented with double quotes.

strip_quotes_from_single_stringsbool, default True

If True, strip the quotes from the return value of a given row if it is a string. If False, values returned for a given row include quotes if they are strings.

missing_fields_as_nullsbool, default False

If True, when an object is queried for a field it does not contain, “null” is returned. If False, when an object is queried for a field it does not contain, None is returned.

Column: New strings column containing the retrieved json object strings


>>> import cudf
>>> s = cudf.Series(
                        "author":"Nigel Rees",
                        "title":"Sayings of the Century",
                        "author":"Evelyn Waugh",
                        "title":"Sword of Honour",
>>> s
    0    {"store": {\n        "book": [\n        { "cat...
    dtype: object
>>> s.str.get_json_object("$")
    0    [\n        { "category": "reference",\n       ...
    dtype: object