#!/usr/bin/python3
""" module that contains a function using json encoding """
import json


def save_to_json_file(my_obj, filename):
    """
    writes an python Object to a text file, using a JSON representation
    """
    with open(filename, mode="w+", encoding="utf-8") as file:
        json.dump(my_obj, file)
