from Hacker News

Ask HN: Parser for the vdata format used in the Source 2 engine?

by Karsteski on 8/11/24, 6:23 PM with 2 comments

Hi, I'm a self-taught junior programmer and I've never written a parser. I was wondering if anyone knew of a parser for the vdata format (example below) used in the Source 2 engine? I want to get character data for this game to make an app, but I've not found any parsers for this weird data format, so I figured I'd have to write one myself before I even got started on my app. Also, any advice on writing a parser? This seems difficult to get right.

.vdata format:

  <!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
  {
      key = "value"
      key = 
      {
          key = "value"
          key2 = "value2"
          "1" = "value"
      }
      key_array =
      {
          [
              1,
              2,
              3,
          ]
      }
  }