Created
September 21, 2017 12:39
-
-
Save rafszul/280abdec3db55ba73eddd7a8ed750522 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sketch JSON Parser | |
================= | |
#### Replaces layer values in groups with JSON data | |
### Setup | |
1. Download/Clone this repo | |
2. Run json-parser.sketchplugin | |
### Example | |
#####1. Say you have a group that looks like this: | |
![Layer Group Example](http://i.imgur.com/wKPFRdu.png) | |
#####2. And a JSON array that looks like this: | |
``` | |
[{ | |
"img": "http://i.imgur.com/IBZMRic.png", | |
"title": "Holabila", | |
"date": { | |
"formatted": "25 Jan 2015", | |
"time_ago": "5 min ago" | |
}, | |
"name": "Koen Vendrik" | |
}, | |
{ | |
"img": "/Users/joeytribbiani/Desktop/350.png", | |
"title": "Bilahola", | |
"date": { | |
"formatted": "28 Feb 2015", | |
"time_ago": "2 days ago" | |
}, | |
"name": "Jaer Pollux" | |
}] | |
``` | |
#####3. Now include JSON path variables in your layer names like this: | |
![Path Variables Example](http://i.imgur.com/JsnUwv2.png) | |
#####4. Duplicate the group as many times as you want and select the groups | |
(in this case probably two times as you have two items in the array) | |
#####5. Run the plugin and paste in the JSON when prompted | |
![Prompt](http://i.imgur.com/sO4JCwi.png) | |
#####6. Voila! The plugin replaced all layer values with data from the JSON | |
![Woah GIF](http://www.reactiongifs.com/wp-content/gallery/omg/RDJ_Woah.gif) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment