Make TriangleModel to JSON conversion safer.