Since the KmlLayer class is deprecated, here is example how to display GeoJson in Google Maps.

Here is an example. Download from here.

For JavaScript part ony one mehtod will be needed: loadGeoJson.

JSON:

{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "properties": {
                "name": "test",
                "description": "test",
                "styleUrl": "styleUrl test"
            },
            "geometry": {
                "type": "LineString",
                "coordinates": [
                    [
                        6.982319,
                        50.2130308,
                        501.04836764077118
                    ],
                    [
                        6.9824246,
                        50.2129917,
                        501.97646533551074
                    ],
                    [
                        6.9826037,
                        50.2127794,
                        501.42517669008419
                    ],
                    [
                        6.9825968,
                        50.2127444,
                        501.50966809629153
                    ]
                ]
            }
        }
    ]
}
Javascript:
map.data.loadGeoJson("badBertrich.geojson");