Export " .json " files for a large number of albums with a specific structure

Hi, I have been familiar with this software for a while and I wanted to thank its developers, I only know the basic use of this software. But I heard that the software is perfect, I need to use this software for a specific case:
My scenario is as follows:
I want to export a json file with a specific structure inside a large number of folders, each containing a music album, I wanted to please help me:
In fact, I want to create a json file in each folder of the music album, which has the following file name:

Album_year - Album_name [info].json

And inside this json file, the complete information of the album and the music tracks of the album should be according to the following structure:

{
  "album": "the lord of the rings",
  "artist": [
    "Jasper Kyde",
    "Howard Shore",
    "Adele",
    "Eminem"
  ],
  "album_Artist": [
    "Jasper Kyde",
    "Howard Shore"
  ],
  "year": 2018,
  "genre": [
    "Soundtrack"
  ],
  "codec": "MPEG-4 AAC",
  "total_size": "86.81 MB",
  "total_tracks": 34,
  "Total_length": "00:40:01",
  "Settings": "269 kbps / 44100 khz / 2",
  "tracks_format": "m4a",
  "track_list": [
    {
      "track_num": 01,
      "track_name": "track_name",
      "track_title": "track title",
      "track_artist": "jasper kyde",
      "track_length": "00:08:20",
      "track_size": "23 mb",
      "track_bitrate": "320kbps"
    },
    {
      "track_num": 02,
      "track_name": "track_name",
      "track_title": "track title",
      "track_artist": "jasper kyde",
      "track_length": "00:08:20",
      "track_size": "23 mb",
      "track_bitrate": "320kbps"
    },
    {
      "track_num": 03,
      "track_name": "track_name",
      "track_title": "track title",
      "track_artist": "jasper kyde",
      "track_length": "00:08:20",
      "track_size": "23 mb",
      "track_bitrate": "320kbps"
    }
  ]
}

I want this json file to be generated for all folders with the same name structure and internal content, what should I do?
Thanks for your guide friends

You don't need the prettyfied view of the JSON-content - with all the spaces and CR/LF - right?

I assume you want to import this data in a following process?

I want to save this json file in a database, it is important that the format of json and its structure is as mentioned above

Please see the help on variables to address the various properties:

I would assume, that you need an overall loop with $loop(%album%)
Then you need a loop for the tracks with a statement $loop(%track%) right in front of

I think that the calculations of totals usually are available at the end of a loop - so right now the total time should follow the track list.

To get

you may try
"album": "%album%",

and so continue with the other data.

Thank you for your help, be honest I have no idea how I can do this, I do not know how to use this software professionally and I do not know how to get the desired output with the desired features of the software I wanted to know if anyone has done this before, who can provide me their configuration file?

It is no shame to be a beginner in a task.
But I wonder how you are ever going to debug the script if you have to rely on the knowledge of others.

I am pretty sure that there are other exports around that produce a json output in the end. But whether that fits your requirements ... I don't know. I don't have it. I could only offer help to learn the functions for export so that you can maintain your script yourself.

1 Like