I have three classes in my program,
Processes contain Lanes.
Lanes contain Tasks.
The objects are stored in each other as arrays with some other string information about the class
I'm trying to output the Process objects into JSON files but I keep getting the following error:
Object of type 'Process' is not JSON serializable
I'm fairly new to JSON processing so I don't understand why the objects are outputting this error.
I'm using the following code to print the Process objects as JSON items:
def outputJSON(self):
        for n in self.processes:
            print(json.dumps(n, sort_keys=True, indent=4))
And these are the class objects:
class Task(object):
    def __init__(self, name, UiD):
        self.name = name
        self.UiD = UiD
        self.incoming = 'None'
        self.outgoing = []
        self.messageFlowIn = 'None'
        self.messageFlowOut = 'None'
    def __str__(self):
        print(self.name +"\n")
        print("Incoming Connection : \n" + self.incoming + "\n")
        print("Outgoing Connections : ")
        if len(self.outgoing) >= 1:
            for n in self.outgoing:
                print(n+"\n")
        print("MessageFlowIn : " + self.messageFlowIn)
        print("MessageFlowOut : " + self.messageFlowOut)
class Lane(object):
    def __init__(self, name, associatedTasks):
        self.name = name
        self.associatedTasks = associatedTasks
class Process(object):
    def __init__(self, name, associatedLaneNames):
        self.name = name
        self.associatedLaneNames = associatedLaneNames
        self.laneObjects = []
How can I correctly output this data to a JSON file?
 
     
     
    