(data, parent=None, key=None)
return data
find all datetime-like strings within data (deserialized json)
    and format them uniformly, in place.
find all datetime-like strings within data (deserialized json)
    and format them uniformly, in place.
find all datetime - like strings within data ( deserialized json ) and format them uniformly in place .
def adjust_datetimes(data, parent=None, key=None):
    """
    find all datetime-like strings within data (deserialized json)
    and format them uniformly, in place.
    """
    # this strips the timezone like we've always done
    # todo: in the future this will convert to UTC
    if isinstance(data, str) and RE_DATETIME_MATCH.match(data):
        try:
            parent[key] = str(json_format_datetime(
                adjust_text_to_datetime(data)
            ))
        except (iso8601.ParseError, ValueError):
            pass
    elif isinstance(data, dict):
        for key, value in data.items():
            adjust_datetimes(value, parent=data, key=key)
    elif isinstance(data, list):
        for i, value in enumerate(data):
            adjust_datetimes(value, parent=data, key=i)

    # return data, just for convenience in testing
    # this is the original input, modified, not a new data structure
    return data
def adjust_datetimes ( data , parent = None , key = None ) : # this strips the timezone like we've always done # todo: in the future this will convert to UTC if isinstance ( data , str ) and RE_DATETIME_MATCH . match ( data ) : try : parent [ key ] = str ( json_format_datetime ( adjust_text_to_datetime ( data ) ) ) except ( iso8601 . ParseError , ValueError ) : pass elif isinstance ( data , dict ) : for key , value in data . items ( ) : adjust_datetimes ( value , parent = data , key = key ) elif isinstance ( data , list ) : for i , value in enumerate ( data ) : adjust_datetimes ( value , parent = data , key = i ) # return data, just for convenience in testing # this is the original input, modified, not a new data structure return data