I’d like to initialize a json structure with channel entries. For the most part it seems to work fine, except for the last entry where you can’t have a comma ending it. It should look something like:
table = [
{"key": "one"},
{"key": "two"},
{"key": "three"}
];So I tried this code:
table = [
{exp:channel:entries channel="mychannel" }
{"key": "{value}"}{if count!=total_results},{/if}
{/exp:channel:entries}
];{value} is from mychannel. The first part of this works fine. The problem is with the conditional. It just prints out the conditional statement rather than evaluating it. So I get something like this for each of the entries:
{"key": "two"}{if "2"!= "3"},{/if}Can I get this to work or is there some other way?
Thanks!