photools.com Community

IMatch Discussion Boards => General Discussion and Questions => Topic started by: ben on February 06, 2022, 01:11:46 PM

Title: Export category hierarchy to json
Post by: ben on February 06, 2022, 01:11:46 PM
Hello everyone,

i am wondering if there is a possibility to export a category, including its hierarchy, to a json file?
Or is this something i do with an API endpoint?
For each file i only need basic information (filename, date, size), but what is important is to know the hierarchy name.

Thanks and have a nice weekend
Ben
Title: Re: Export category hierarchy to json
Post by: Mario on February 06, 2022, 01:38:03 PM
It's is not clear what you want to achieve.

Quotei am wondering if there is a possibility to export a category, including its hierarchy, to a json file?

Do you want to export the category name and children names?
The default export format for categories in IMatch is XML, which can be easily transformed into JSON (online converters).
Or you use the /v1/categories endpoint to pull the category names into your browser.

QuoteFor each file i only need basic information (filename, date, size), but what is important is to know the hierarchy name.

This sounds like you want to export information for files in a category to JSON?
This should be doable via the  Text Export (https://www.photools.com/help/imatch/#impexp_text.htm) feature. Have you tried that?

For example:

Name: {File.FullName}
Date: {File.DateTime}
Size: {File.Size}
Categories: {File.Categories}


(https://www.photools.com/community/index.php?action=dlattach;topic=12283.0;attach=29034;image)

produces JSON output like this:

(https://www.photools.com/community/index.php?action=dlattach;topic=12283.0;attach=29036;image)

Note that you can control the formatting of dates and numbers via the variable, you can limit the extracted categories etc.
See Variables (https://www.photools.com/help/imatch/#var_basics.htm) for full details.
Title: Re: Export category hierarchy to json
Post by: ben on February 07, 2022, 01:23:32 PM
Dear Mario,

Thanks for explaining the different options (many as always).
I will wrap my head around what is the best way to go.

I am basically extending the automation of my digital picture frame.
This should involve as few manual steps as possible (currently it's a one button thing).

So i assume i will go with the API endpoint approach.

Thanks again.
Ben