complete method for serializing simulation data to json

format is:
        {
            "timeLine": [1, 2, 3, 4, 5],
            "stimulusCurrent": {
                    "magnitude": 0.0,
                    "x": 0.0,
                    "y": 0.0,
                    "z": 0.0
            },
            "fibers": [ # a list of fiber objects
                {
                    "x": 0.0,
                    "y": 0.0,
                    "diameter": 12.0,
                    "internodalLength": 2,
                    "axonalLength": 1,
                    "nodes": [ # a list of node objects
                        {
                            "index": 0,
                            "distanceFromStimulus": 0.2,
                            "voltage": [1, 2, 3, 4],
                            "m": [1, 2, 3, 4],
                            "h": [1, 2, 3, 4],
                            "n": [1, 2, 3, 4],
                            "iNa": [1, 2, 3, 4],
                            "iK": [1, 2, 3, 4],
                            "iL": [1, 2, 3, 4],
                            "externalPotential": [1, 2, 3, 4]
                        }
                    ]
                },
                {
                    "x": 0.0,
                    "y": 0.0,
                    "diameter": 0.0,
                    "internodalLength": 0.0,
                    "axonalLength": 0.0,
                    "nodes": [
                        {

                        },
                        {

                        }
                    ]
                }
            ]
        }