[V2] Can't get data out {{ response }} for JSON starting with arrays
Opened this issue · 3 comments
Deleted user commented
For an API not starting with an array this works:
{{ placid:request url="http://httpbin.org/get" cache="0" }}
{{ if no_results }}
<h1>No results</h1>
{{ else }}
<h1>Results</h1>
<ul>
<li>{{ url }}</li>
<li>{{ origin }}</li>
</ul>
{{ /if }}
{{ /placid:request }}
But as per the docs for an API that returns and array I can't get any data out:
{{ placid:request url="http://jsonplaceholder.typicode.com/posts" cache="0" }}
{{ if no_results }}
<h1>No results</h1>
{{ else }}
<h1>Results</h1>
{{ response }}
<ul>
<li>{{ id }}</li>
<li>{{ title }}</li>
</ul>
{{ /response }}
{{ /if }}
{{ /placid:request }}
Note that {{ if no_results }}
is not triggered so data is returned.
alecritson commented
Hey @netnak
Thanks for pointing this out, looks like v2 needs slightly different returns to get it to output for arrays, this should now be fixed if you download the latest.
Deleted user commented
Works great, thank you for the quick response.
FYI, even data that previously didn't need to be wrapped in the {{ response }}
tag as per my first example now requires to be wrapped in it.
alecritson commented
No worries.
Thanks for the heads up about the {{ response }}
tag, this should now be fixed in 2.0.3