Skip to content

Instantly share code, notes, and snippets.

@ardeay
Last active March 2, 2017 22:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ardeay/1b8a4ccffd5bf1b8035df23e3eccb460 to your computer and use it in GitHub Desktop.
Save ardeay/1b8a4ccffd5bf1b8035df23e3eccb460 to your computer and use it in GitHub Desktop.
JSON Parsley Example
{
"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