Skip to content

Instantly share code, notes, and snippets.

@OliverF
OliverF / JBeamToJSON.cs
Created September 30, 2015 11:50
In BeamNG.drive, the configuration files use the proprietary standard "JBeam", which is very similar to JSON but with more relaxed rules. This C# function converts JBeam strings into JSON, so that they can be parsed and edited easily by some 3rd party JSON library. There's some lazy programming here that could be cleaned up, but I have since sto…
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
private static string JBeamToJSON(string jbeamtext)
{
jbeamtext = Regex.Replace(jbeamtext, @"//.*\r\n", delegate(Match match)
{