def _from_json(doc):
    """Invert _to_json()"""
    if "$numberLong" in doc:
        return int(doc["$numberLong"])
    elif "__nonstring_keys" in doc:
        nonstring_keys = doc.pop("__nonstring_keys")
        return {nonstring_keys[k]: v for k, v in doc.items()}
    else:
        return doc