API-Source: https://api.json-content-importer.com/extra/json/2.json
If your JSON starts with “[{” try this (or see here if you add some more twig code):
JCI-template:
- Name: contextparent
- URL: https://api.json-content-importer.com/extra/json/2.json
_context<br> _context.0.id: {{_context.0.id}}<br> _context : {{_context | json_encode }}<br> {% for item in _context %} item {{loop.inxes}}: {{item | json_encode}}<br> {% endfor %} <hr> _parent<br> _parent.0.id: {{_parent.0.id}}<br> {% for item in _parent %} _parent : {{_parent | json_encode }}<br> item {{loop.inxes}}: {{item | json_encode}}<br> {% endfor %}
Shortcode:
[jsoncontentimporterpro nameoftemplate="contextparent"]
twig defines some Global Variables
_self
: references the current template name;_context
: references the current context;_charset
: references the current charset.
_parent is almost the same as _context but:
note the difference of _context and _parent loops
In Action:
curlGET failed, http-code: 301