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

**URL:** https://community.mp3tag.de/t/export-json-files-for-a-large-number-of-albums-with-a-specific-structure/55678
**Category:** Export
**Created:** [December 31, 2021, 10:20am UTC](https://community.mp3tag.de/t/export-json-files-for-a-large-number-of-albums-with-a-specific-structure/55678 "2021-12-31T10:20:04Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Elina](https://community.mp3tag.de/user_avatar/community.mp3tag.de/elina/32/10614_2.png) [@Elina](https://community.mp3tag.de/u/Elina)
#### Post date: [December 31, 2021, 10:20am UTC](https://community.mp3tag.de/t/export-json-files-for-a-large-number-of-albums-with-a-specific-structure/55678/1 "2021-12-31T10:20:04Z")

</div>

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** :

```auto
{
  "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

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [December 31, 2021, 10:43am UTC](https://community.mp3tag.de/t/export-json-files-for-a-large-number-of-albums-with-a-specific-structure/55678/2 "2021-12-31T10:43:27Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Elina](https://community.mp3tag.de/user_avatar/community.mp3tag.de/elina/32/10614_2.png) [@Elina](https://community.mp3tag.de/u/Elina)
#### Post date: [December 31, 2021, 10:59am UTC](https://community.mp3tag.de/t/export-json-files-for-a-large-number-of-albums-with-a-specific-structure/55678/3 "2021-12-31T10:59:49Z")

</div>

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**

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [December 31, 2021, 11:07am UTC](https://community.mp3tag.de/t/export-json-files-for-a-large-number-of-albums-with-a-specific-structure/55678/4 "2021-12-31T11:07:47Z")

</div>

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

> **[Exporting Tag and File Information – Mp3tag Documentation](https://docs.mp3tag.de/export/)**
>
> Documentation on exporting tag and file information to text-based file formats. Mp3tag is the universal Tag Editor.

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

> [@Elina](#):
>
> `"track_list": [`

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

> [@Elina](#):
>
> `"album": "the lord of the rings",`

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

and so continue with the other data.

---

<div class="post-metadata">

### Author: ![Elina](https://community.mp3tag.de/user_avatar/community.mp3tag.de/elina/32/10614_2.png) [@Elina](https://community.mp3tag.de/u/Elina)
#### Post date: [December 31, 2021, 4:34pm UTC](https://community.mp3tag.de/t/export-json-files-for-a-large-number-of-albums-with-a-specific-structure/55678/5 "2021-12-31T16:34:15Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [December 31, 2021, 5:46pm UTC](https://community.mp3tag.de/t/export-json-files-for-a-large-number-of-albums-with-a-specific-structure/55678/6 "2021-12-31T17:46:32Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Palladio](https://community.mp3tag.de/user_avatar/community.mp3tag.de/palladio/32/10154_2.png) [@Palladio](https://community.mp3tag.de/u/Palladio)
#### Post date: [May 20, 2022, 6:50pm UTC](https://community.mp3tag.de/t/export-json-files-for-a-large-number-of-albums-with-a-specific-structure/55678/7 "2022-05-20T18:50:44Z")

</div>

Hello, has anyone ever shared a file that does this process and generates .json output to the community?

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [May 20, 2022, 8:18pm UTC](https://community.mp3tag.de/t/export-json-files-for-a-large-number-of-albums-with-a-specific-structure/55678/8 "2022-05-20T20:18:23Z")

</div>

There is no ready-to-use JSON export in Mp3tag.  
You can export whatever you need with Mp3tag in [CSV or others formats](https://community.mp3tag.de/t/export-configuration-archive/1495) and then transform it to JSON externally.
