PavelLaptev / JSON-to-Figma

An easy way to populate Figma layers with JSON
MIT License
142 stars 40 forks source link

Support for object and not only array of objects #57

Open barning opened 1 year ago

barning commented 1 year ago

Hey, would it be possible to also support this kind of json?

{
  "name": "John Doe",
  "age": 32,
  "is_admin": true,
  "skills": ["JavaScript", "HTML", "CSS"]
}

My workaround right now is to put the object into an array. Some APIs simply don't return an array of objects and this change would be really helpful.

jausto commented 1 year ago

bump!

PavelLaptev commented 1 year ago

@barning your example is just one object. You can't fill multiple things with it. Can you provide another example? How it would look like?

Like this?

{
  "user1": {
    ...data
  },
  {
  "user2": {
    ...data
  }
}
barning commented 1 year ago

Yes, it would look like this.

PavelLaptev commented 1 year ago

@barning @jausto can you add here a few real samples I can work with? Don't need to share whole files, but real example will be helpful.

barning commented 1 year ago

@PavelLaptev I cannot share real examples but this comes pretty close.

{
  "id": 1231511,
  "urn": "urn",
  "tag": "tag",
  "boolean": true,
  "name": "Name",
  "keywords": null,
  "zip_code": "*",
  "city": "*",
  "country": "de",
  "visible": true,
  "public": true,
  "array": [
    "1",
    "2",
    "3"
  ],
  "another_array": [
    "1",
    "2",
    "3"
  ],
  "another_boolean": true
}