Last active
March 2, 2017 22:15
-
-
Save ardeay/1b8a4ccffd5bf1b8035df23e3eccb460 to your computer and use it in GitHub Desktop.
JSON Parsley Example
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
{ | |
"data": [ | |
{{each blog_article as art limit 20 }} | |
{ | |
"zid" : {{art.zid}}, | |
"url" : "{{art.getUrl()}}", | |
"name" : "{{art.title}}", | |
"image": "{{art.image.getImage()}}", | |
"image_thumbnail": "{{art.image.getImage(200,200,crop)}}", | |
"body" : "{{art.article_body.escapeForJs()}}", | |
"tags" : [ | |
{{each blog_tag as tag where find_in_set(tag.zid,'{art.tags}') }} | |
{ | |
"zid" : {{tag.zid}}, | |
"name" : "{{tag.name}}" | |
} | |
(** echo a the comma unless it is the last item **) | |
{{if {tag._length} != {tag._num} }},{{end-if}} | |
{{end-each}} | |
] | |
} | |
(** echo a the comma unless it is the last item **) | |
{{if {art._length} != {art._num} }},{{end-if}} | |
{{end-each}} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment