Export labels into a custom text file

Hello!
I’m new in this forum, not sure if this is the correct section to write this.
I’m a very beginner programmer, and I would like to make a “simple” exporter to export the labels of an audio into a custom text file.
The text file format is very simple:

Markers
{
    Marker
    {
        Name="Label name"
        Pos="Position in samples"
    }
    Marker
    {
        Name="Label name"
        Pos="Position in samples"
    }
}

The idea is to create a “Marker” block for each sample. I have some questions about it.
1 - Is possible to create an exporter to do this?
2 - How should I start? Could be done in python?

Thanks!

Using Audacity’s scripting module, you can issue the command “GetInfo: Type=Labels” which will return the labels formatted as a JSON string like this:

[ 
  [ 1,
    [ 
      [ 0.0590437, 0.0590437, "Label one" ],
      [ 0.508684, 0.508684, "Label 2" ],
      [ 0.920476, 1.03554, "Region label" ] ] ] ]

(The “1” on the second line indicates the track number)

You can find some information about scripting in Audacity here: Scripting - Audacity Manual