I read in the documentation that .jbeam is a little modified .json, but doesn't actually say specifically how. Parsing .jbeam with a conventional .json library won't work. I tried nlohmans library https://github.com/nlohmann/json. Is there a jbeam library or something that would help me? Anything? (I know that official beamng editor built in QT can parse and export jbeam, so I will have look at the source).
The parsing is relatively simple. At least before, the main differences to JSON were 1) JBEAM allows C-style comments 2) JBEAM does not care about commas, while JSON parsers usually requires them to be correct How the parsing is perhaps easiest to implement, is to convert the JBEAM to valid JSON, and then parse it with a JSON parser. So remove the C-style comments, and fix the commas, then parse with a JSON parser. Or alternatively, I believe you could use BeamNG's own lua parser. Here in this quite messy NB editor file at line around 2907 is the JBEAM parsing code currently used: https://github.com/RORMasa/NodeBeamEditor/blob/master/source/NodeBeam.cpp The file also contains old obsolete parsing and exporting code that is not in use, that you can ignore. Fixing the commas and removing the comments might be cleaner to do with regular expressions.