"Feature Request" Direct JSON Export in future Updates

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

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:

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

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.

{ 
	"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.

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

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

and

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

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.

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.

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

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.

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.

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:

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

and apparently the purpose

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.

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

$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()
1 Like

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

Modify the script to:

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

and

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

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. :pray: :pray: :four_leaf_clover: :four_leaf_clover: :pray: :pray:

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

3 posts were split to a new topic: Customize ouput of total length to h m without seconds