Please help, I am really stuck with Metadata and JSON Export

Are you getting both of these outputs with the File > Export > Metadata (JSON) ?

Because that is exactly what I need, minus the uuid, creation, modification and put int the format of the 2nd image.

The latest version 3.8.7 is also available on our website (e.g. if DEVONthink’s check for updates is blocked by a firewall, LittleSnitch etc.)

From what you wrote before, it is not exactly what you need. If only because the export doesn’t use your custom metadata name, but the internal format (mdprimarycolor, for example). Also, the output is wrapped in an array, even if there’s only data for a single file exported. And there’s no provision to group metadata like you do with the attributes property.

They were not, and they said so. You could, BTW, use the Help menu in DT, type “JSON” and you’ll be directly send to the appropriate menu entry.

No!

I wrote a script that (hopefully) does exactly what you asked for. It’s in post number 4. We’re now at post number 24 … and it turns out you did not even try the script.

I already asked whether the script works for you … you did not answer that question.

What more can I do than

  • posting a well tested script
  • writing “This script creates a JSON file for each selected record.”
  • posting captures of the output to show the difference between the DEVONthink menu File > Export > Metadata (JSON) and my script
  • asking whether the script works for you

Instead of trying my obviously working script (as you now already know because you’ve meanwhile found the capture of the script output …) you tried to run a script whose author clearly wrote: “NOT TESTED!”.

What I really don’t get: why did you thank me if you did not test the script?

Use this AppleScript.

2 Likes

Yes I did try the script and I kept getting nothing but errors when trying to compile it … As I stated in several replies back.

I will do it again right now as instructed, but it will not even compile when I do so in all the applications that I listed previously.

I get nothing but a long list of errors on why it will not compile.

I will follow your instructions again and try again right now.

It is working Great thank you!

I am just trying to get the data fields in a different order and add additional identifiers.

When I put a defined path inside the path to desktop, I get nothing but errors, which I am sure are my fault. The reason that I know this is because when I create a folder named “Script Output” it works just as you said it would.

I am just working to identify the additional fields that I would like inside the JSON file.

How do I tell it to reverse the order that it is printing. I believe that this may be important for the object identifiers on the rest api.

YOU ARE AMAZING by the way!!

I just wanted to tell you that!

Thank you SO SO SO MUCH!

1 Like

I’ve updated the script in the original post. It now got an additional property sortKeys. If it’s true keys are sorted, if false they appear in the order they were added.

If you want key B to appear above key A just move the lines that add key B before the ones that add key A.

Not to put too fine a point on it but the order of „keys“ in JSON files doesn’t matter one bit. It’s a format to serialize JavaScript objects, with the keys corresponding to the object properties. And the latter have no „order“. We’re not dealing with C structures here, fortunately.

2 Likes