# "Feature Request" Direct JSON Export in future Updates

**URL:** https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629
**Category:** Export
**Created:** [June 14, 2022, 1:40pm UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629 "2022-06-14T13:40:32Z")
**Posts on this page:** 19
**Page:** 1

<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: [June 14, 2022, 1:40pm UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629/1 "2022-06-14T13:40:32Z")

</div>

Is it possible that in the next updates, the ability of direct Export in "JSON" format will be added to the software?

---

<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: [June 14, 2022, 1:44pm UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629/2 "2022-06-14T13:44:57Z")

</div>

Doesn't the structure of a json file depend on the target application?

So here is a thread about a json export that did not really get to an end but perhaps you get some ideas on how to go about:

> [@Export " .json " files for a large number of albums with a specific structure](https://community.mp3tag.de/t/export-json-files-for-a-large-number-of-albums-with-a-specific-structure/55678):
>
> 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 follow…

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [June 14, 2022, 2:29pm UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629/3 "2022-06-14T14:29:32Z")

</div>

> [@Palladio](#):
>
> Is it possible that in the next updates, the ability of direct Export in "JSON" format will be added to the software?

Do you have a specific structure in mind? What's the use case?

---

<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: [June 14, 2022, 6:56pm UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629/4 "2022-06-14T18:56:48Z")

</div>

Yes, I have a very useful structure that can be used to archive and create a suitable file for use in a very modular database.  
This structure, especially when it is in the form of a Jason file, can be very useful and reusable, especially in the field of archiving and storing information in databases.  
Considering that the JSON format is the standard format of many databases and the uses of this format in modern software, in my opinion, it is even worth adding an option to the software menu for direct output with the JSON format and the ability to configure output information.

Use case of Jason output :

- The first and most important use can be the extensive use of the .json in modern web applications and databases, and that this output can be easily used in databases. And increases the level of application and use of software
- If we want to extract a large number of directories from different albums and use them for storage in the database can be very useful, use the album details info for archiving and save the output file in the database for faster access
- Ability to import and index album information and specifications for faster search and call album information
- Ability to use optimally in the field of data retrieval after saving on the device
- Extensive use of Jason outputs in future software and applications for archiving and calling faster and more efficient album specifications
- Output .json format with the ability to configure and customize the output structure can greatly increase the use of software in extracting and archiving album information

My suggested structure for Jason output is as follows, which includes general album information and detailed track record information.

```auto
{ 
	"album_name": "Best of Debussy",
	"album_directory": "G:\\new folder\\Claude Debussy - Best of Debussy (2020)",
	"album_artist": "Claude Debussy, Henrik Måwe, Richard Kegel, Sayer Obert",
	"album_genre": "Classical",
	"album_year": "2017",
	"album_track": "24",
	"album_size": "324.38 MB",
	"album_extension": "mp3",
	"album_bitrate": "320",
	"album_length": "04:02:20",
	"album_trackList": [
		{ 
			"_filename": "01 - Préludes Book I, L. 117 VIII. La fille aux cheveux de lin",
			"_album": "Best of Debussy",
			"_genre": "Classical",
			"_title": "Préludes Book I, L. 117: VIII. La fille aux cheveux de lin",
			"_artist": "Claude Debussy, Henrik Måwe",
			"_track": "01",
			"_file_size": "5.38 MB",
			"_extension": "mp3",
			"_bitrate": "320",
			"_length": "02:20"
		},
		{ 
			"_filename": "02 - Préludes Book I, L. 117 X. La Cathédrale engloutie",
			"_album": "Best of Debussy",
			"_genre": "Classical",
			"_title": "Préludes Book I, L. 117: X. La Cathédrale engloutie",
			"_artist": "Claude Debussy, Henrik Måwe",
			"_track": "02",
			"_file_size": "13.28 MB",
			"_extension": "mp3",
			"_bitrate": "320",
			"_length": "05:47"
		},
		{ 
			"_filename": "03 - Suite bergamasque, L. 75 I. Prélude",
			"_album": "Best of Debussy",
			"_genre": "Classical",
			"_title": "Suite bergamasque, L. 75: I. Prélude",
			"_artist": "Claude Debussy, Peter Schmalfuss",
			"_track": "03",
			"_file_size": "9.50 MB",
			"_extension": "mp3",
			"_bitrate": "320",
			"_length": "04:08"
		},
		{ 
			"_filename": "04 - Suite bergamasque, L. 75 II. Menuet",
			"_album": "Best of Debussy",
			"_genre": "Classical",
			"_title": "Suite bergamasque, L. 75: II. Menuet",
			"_artist": "Claude Debussy, Peter Schmalfuss",
			"_track": "04",
			"_file_size": "9.80 MB",
			"_extension": "mp3",
			"_bitrate": "320",
			"_length": "04:16"
		},
		{ 
			"_filename": "05 - Suite bergamasque, L. 75 III. Clair de lune",
			"_album": "Best of Debussy",
			"_genre": "Classical",
			"_title": "Suite bergamasque, L. 75: III. Clair de lune",
			"_artist": "Claude Debussy, Finghin Collins",
			"_track": "05",
			"_file_size": "12.02 MB",
			"_extension": "mp3",
			"_bitrate": "320",
			"_length": "05:14"
		}
	]
}

```

It should be noted that values, numbers and texts are examples and are inserted to represent the final structure.  
This structure can be used in a wide range of cases and includes complete information and details of each album and its tracks.

---

<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: [June 14, 2022, 7:04pm UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629/5 "2022-06-14T19:04:27Z")

</div>

Did you have a look at the export feature?  
That generates a text output.  
The source is an export script that you can fill according to your needs with text constants like

> [@Palladio](#):
>
> `"album_name": `

and add %album% to insert the data from that tag field, e.g. "Best of Debussy".

this applies to most other data, see the documentation

> **[Tag Field Mappings – Mp3tag Documentation](https://docs.mp3tag.de/mapping/)**
>
> Overview of all available tag fields, their names in Mp3tag, and how they are mapped to the internal structures of the different tag formats. Mp3tag is the universal Tag Editor.

and

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

---

<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: [June 14, 2022, 7:38pm UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629/6 "2022-06-14T19:38:31Z")

</div>

If this feature is added specifically for the .json format, it can be much more practical and professional

---

<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: [June 14, 2022, 7:45pm UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629/7 "2022-06-14T19:45:50Z")

</div>

My suggestion would have been that you start with modfying you json template and add the variables and then offer it to the community.

This could serve as an example for others to adapt such a script for their needs just like e.g. the html scritps.

---

<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: [June 14, 2022, 8:10pm UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629/8 "2022-06-14T20:10:31Z")

</div>

Many users of this software do not know anything about programming and personalization of scripts. On the other hand, the ability to extract album information is very useful and required, and configuration and personalization should not be so difficult and complicated. Especially for important and useful formats like JSON format.  
It is better to simplify the process of outputting album information in different formats so that more people can use it easily. This process is currently very complicated and non-customizable, for people who do not have information about programming and script .  
It is better to simplify the option of different outputs and configure the output file structure so that there is no need for everyone to change the codes and scripts according to their needs.

---

<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: [June 14, 2022, 8:23pm UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629/9 "2022-06-14T20:23:36Z")

</div>

I am not really sure that I understand what the result of your feature request should be.  
So far the export function creates text output which then is used by a target application that understands how to deal with that plain text.  
That is why there are sample scripts for csv, rtf, html.  
If json also falls into this category then I think that there would be nothing more than another sample script, only this time featuring the json convention.  
So, if your example could serve as basis for sample script - what hinders you to create such a script?  
Or, where and how do you expect the export function to create a text out to become less

> [@Palladio](#):
>
> complicated and non-customizable

---

<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: [June 14, 2022, 8:46pm UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629/10 "2022-06-14T20:46:30Z")

</div>

In fact, I, who am personally an interface designer and developer and a little familiar with coding and development, have not yet been able to get a proper output in Jason format from the software.  
While many users of this software are not even slightly familiar with development and coding.  
In fact, getting the output in the appropriate format and with the desired configuration is perhaps very difficult and even impossible for more than 90% of users of this software, and this is a defect in the user experience of the software and its capabilities.  
I suggest making the output process in a customized format and configuration more efficient and easier so that more people can use this useful feature.

In the field of design and structure of the output file and issues related to the user interface, I will do whatever help is needed.

---

<div class="post-metadata">

### Author: ![MotleyG](https://community.mp3tag.de/user_avatar/community.mp3tag.de/motleyg/32/440_2.png) [@MotleyG](https://community.mp3tag.de/u/MotleyG)
#### Post date: [June 14, 2022, 11:48pm UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629/11 "2022-06-14T23:48:50Z")

</div>

> [@Palladio](#):
>
> In fact, getting the output in the appropriate format and with the desired configuration is perhaps very difficult and even impossible for more than 90% of users of this software, and this is a defect in the user experience of the software and its capabilities.

But the entire design purpose of the software is to embed the desired tag information _into_ the user’s music files.

The various export formats are certainly within the standards that have been available for many, many years. If that is the method of choice to back up for some, then that is sufficient. But really once the information has been embedded into the music, it is the backup of that library that would be more critical in the end.

---

<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: [June 15, 2022, 5:47am UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629/12 "2022-06-15T05:47:25Z")

</div>

> [@Palladio](#):
>
> have not yet been able to get a proper output in Jason format from the software

So, what have you tried so far?  
It is much easier to help if the help can be built on some kind of foundation.

OK, just to cut this a little short: here is an attempt to fill your structure:

```auto
$filename(json_out.txt,utf-8)$char(123)
$loop(%album%)$loop(%album%)$loopend()
"album_name": "%album%",
"album_directory": "%_folderpath%",
"album_artist": "%albumartist%",
"album_genre": "%genre%",
"album_year": "%year%",
"album_track": %_total_tracks%,
"album_size": %_total_size%,
"album_extension": "%_extension%",
"album_bitrate": "%_bitrate%",
"album_length": "%_total_time%",
"album_trackList": $char(91)$loop(%track%)$char(123)

"_filename": "%_filename%",
"_album": "%album%",
"_genre": "%genre%",
"_title": "%title%",
"_artist": "%artist%",
"_track": $num(%"track%",2),
"_file_size": "%_file_size%",
"_extension": "%_extension%",
"_bitrate": "%_bitrate%",
"_length": "%_length%"
$char(125),$loopend()
$char(93)$char(125)
$loopend()
$char(125)

```

IMHO the information for Genre, bitrate and extension does not make sense as tracks in an album could have different genres, the bitrate could vary if you have recorded them that way and/or there different kinds of files in that album (e.g mp3 plus mp4 for the video)  
On the other hand, I am missing other vital information for the tracks like composer, involved people, lyrics, original year, language.

That is why I asked:

> [@ohrenkino](#):
>
> Doesn't the structure of a json file depend on the target application?

and apparently the purpose

> [@Palladio](#):
>
> a very useful structure that can be used to archive

is not really up to the mark as a fair number of pices of information do not have anything to do with tag backup but are part of the header which cannot be written back to the file from the backup.

---

<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: [June 15, 2022, 11:07am UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629/13 "2022-06-15T11:07:08Z")

</div>

Thank you for posting this script and I edited it a bit:

- put an extra character at the end which I deleted
- Produces a list of all artists in albums with different artists
- The track number was not displayed correctly, it was corrected
- I changed the file format to Jason
- Number of album tracks corrected
- Define a new option to display the value of "different artists" if the number of artists in an album is more than 3

I want to complete this script and publish it in a community for everyone to use, but:

But there is a **big problem** that **puts a comma** in the export of the **"album\_trackList"** for the **last track of the album.**  
Is there a way to prevent the production of the last comma?  
By solving this problem, almost a suitable output is obtained, which can be used for various purposes

If we can **delete the comma** in the **"album\_trackList"** after the last track information from the album, we will reach a standard and orderly structure in the JSON format and it is complete, the output will be excellent

![2022-06-15_145239](https://community.mp3tag.de/uploads/default/original/2X/9/99d73ff74cd1187222df23d26c50429669767583.png)

```auto
$filename(%album% (json_export).json,utf-8)$char(123)
$loop(%album%)$loop(%album%)$loopend()
"album_name": "%album%",
"album_artist": "$loop(%album%,1)$loop(%artist%,1)$puts(ListOfArtists,$get(ListOfArtists){%artist%)$loopend()$puts(ListOfArtists,$cutLeft($get(ListOfArtists),1))$puts(NumberOfArtists,$add($sub($len($get(ListOfArtists)),$len($replace($get(ListOfArtists),{,))),1))$if($grtr($get(NumberOfArtists),3),Various Artists,$replace($get(ListOfArtists),{,',' ))$puts(ListOfArtists,)$loopend()",
"album_artists": "$loop(%ALBUM%)$puts(ListOfArtists,)$loop(%ARTIST%)$loop(%ALBUM%)$puts(ListOfArtists,$get(ListOfArtists)%ARTIST%', ')$loopend()$loopend()$loop(%ALBUM%)$puts(ListOfArtists,$trim($regexp($get(ListOfArtists),'(?:(?<=,)|(?<=\A)|(?<=^))\s?([^,]*),(?=.*?(?<=,)\s?\1(?=,|\Z|$))(?#remove dups from comma- or comma+space- delimited list)',),', '))$loopend()$loop(%ALBUM%,1)$get(ListOfArtists)$loopend()$loopend()",
"album_genre": "%genre%",
"album_year": "%year%",
"album_track": "%_total_files%",
"album_size": "%_total_size%",
"album_extension": "%_extension%",
"album_bitrate": "%_bitrate%",
"album_length": "%_total_time%",
"album_trackList": $char(91)$loop(%track%)$char(123)

"_filename": "%_filename%",
"_album": "%album%",
"_genre": "%genre%",
"_title": "%title%",
"_artist": "%artist%",
"_track": "$num(%track%,2)",
"_file_size": "%_file_size%",
"_extension": "%_extension%",
"_bitrate": "%_bitrate%",
"_length": "%_length%"
$char(125),$loopend()
$char(93)$char(125)
$loopend()

```

---

<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: [June 15, 2022, 6:17pm UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629/14 "2022-06-15T18:17:44Z")

</div>

> [@Palladio](#):
>
> `$loop(%ALBUM%)$puts(ListOfArtists,)$loop(%ARTIST%)$loop(%ALBUM%)$puts(ListOfArtists,$get(ListOfArtists)%ARTIST%', ')$loopend()$loopend()$loop(%ALBUM%)$puts(ListOfArtists,$trim($regexp($get(ListOfArtists),'(?:(?<=,)|(?<=\A)|(?<=^))\s?([^,]*),(?=.*?(?<=,)\s?\1(?=,|\Z|$))(?#remove dups from comma- or comma+space- delimited list)',),', '))$loopend()$loop(%ALBUM%,1)$get(ListOfArtists)$loopend()$loopend()`

Is there a solution that the **last comma after the last track of the album** can be removed?

---

<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: [June 15, 2022, 6:37pm UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629/15 "2022-06-15T18:37:02Z")

</div>

Modify the script to:

```auto
$loop(%album%)$puts(mm,%_counter%)$loopend()"album_genre": "%genre%",
"album_year": "%year%",

```

and

```auto
"_length": "%_length%"
$char(125)$if($neql(%track%,$get(mm)),',',)$loopend()
$char(93)$char(125)
$loopend()

```

---

<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: [June 15, 2022, 7:38pm UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629/16 "2022-06-15T19:38:45Z")

</div>

Thank you very much my dear friend for sending this script and helping to complete and modify this script, I will complete this script over time that is suitable for different scenarios and I will put it in the community. To use the other friends who need it. 🙏 🙏 🍀 🍀 🙏 🙏

---

<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: [June 15, 2022, 8:07pm UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629/17 "2022-06-15T20:07:08Z")

</div>

Thank you.

Still I think that all the export scripts will have to be adapted for the respective target application - if you look at the linked thread of another attempt to get json output, then hardly any identifier/label for the fields matches your script.

So I am still not sure what a process should look like that makes the generation of such a script less

> [@Palladio](#):
>
> complicated and non-customizable

---

<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: [September 14, 2022, 5:56pm UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629/18 "2022-09-14T17:56:47Z")

</div>

3 posts were split to a new topic: [Customize ouput of total length to h m without seconds](https://community.mp3tag.de/t/customize-ouput-of-total-length-to-h-m-without-seconds/58477)

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [January 31, 2025, 12:36pm UTC](https://community.mp3tag.de/t/feature-request-direct-json-export-in-future-updates/57629/19 "2025-01-31T12:36:11Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
