Skip to main content
Participant
November 21, 2023
Question

Convert psd to json

  • November 21, 2023
  • 3 replies
  • 3249 views

 I need to convert .psd files to .json and this must support smart objects, this means, data should contain warp information.

I was able to extract the relevant information but I can't do it with the smart objects.
What do I need to take into account to achieve this?

Is there any language and library that will make it easier for me to complete the job?.

 

 

3 replies

Participant
September 25, 2025
18.psd
Participant
September 7, 2024

Hi @Ian3372262125qy 

 

Did you resolve your problems? Could you share the source code or library you are using so I can dig into it?

Participant
September 7, 2024
yes, I used psd tools
Legend
November 21, 2023

This is nonsensical. JSON is a text format for objects. Photoshop creates and edits image formats.

Participant
November 21, 2023

Yes, I understand, but the idea is to extract information from the PSD. I was able to extract information from each layer, but I'm having trouble doing it with the smart objects. Maybe with this example, I can explain myself more

 

{
  "size": {"width": 1577, "height": 2100},
  "layers": [
    {
      "id": "7aca6d04-537d-4213-bb45-de9a36a1fb01",
      "layername": "Highlights",
      "opacity": 100,
      "size": {"height": 451, "width": 479},
      "src": "x7M/rv7pN8t3N1zSWHNjydWlEFZ1GXMPd...",
      "src_type": "data",
      "type": "normal",
      "visibility": true,
      "position": {"x": 598, "y": 1302},
      "scale": {"x": 1, "y": 1},
      "filters": {},
      "has_mask": false,
      "duplicates": []
    },
    {
      "id": "cd86358c-5f38-4914-8b76-b60b2306f911",
      "layername": "Shadows",
      "opacity": 100,
      "size": {"height": 451, "width": 479},
      "src": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAd8AAAHDCAYAAAB...",
      "src_type": "data",
      "type": "normal",
      "visibility": true,
      "position": {"x": 598, "y": 1302},
      "scale": {"x": 1, "y": 1},
      "filters": {},
      "has_mask": false,
      "duplicates": []
    },
    {
      "id": "f1cbffa6-57b4-4043-9dc4-e606764cb1c4",
      "layername": "mm_wrp:Your Image",
      "opacity": 100,
      "size": {"width": 310, "height": 519},
      "src": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAT...",
      "src_type": "data",
      "type": "smart-object",
      "visibility": true,
      "position": {"x": 602, "y": 1299},
      "scale": {"x": 1.5483870967741935, "y": 0.8805394990366089},
      "filters": {
        "perspective": {"active": true, "corners": [{}, {}, {}, {}]},
        "warp": {
          "active": true,
          "bounds": {},
          "name": "Warp Tool",
          "slug": "warp-tool",
          "meshPoints": [],
          "uOrder": 4,
          "vOrder": 4,
          "warpPerspective": 0
        }
      },
      "has_mask": true,
      "child_object": {"layers": [], "placeholder": "placeholder", "size": {"width": 310, "height": 519}},
      "mask": "821bc723-0f1a-4a7e-a08b-9e3a7d3ac93c",
      "duplicates": []
    }
  ]

 

Legend
November 21, 2023

So you aren't converting anything to JSON, you are extracting metadata.

Adobe has XMP support, you can find many scripts (Extendscript, a variant of JavaScript) posted here that deal with metadata. Or you can use EXIFTool which is a free command line app that is FAR more capable than Adobe's implementation. EXIFTool uses PERL and should be easily compatible with Python and JavaScript if you need more processing than what is built in.

https://helpx.adobe.com/photoshop/using/scripting.html

https://exiftool.org/