We have used amp-list and amp-mustache successfully in several situations.
However, the requirement that the root term is "items":[{}] is limiting and basically requires full edit control of the target JSON file.
Example:
Here's our proposal:
Require the developer to specify the root term when reading a HTTPS/CORS/JSON document.
A developer already has to specify tree navigation with a series of open and close (# and /) statements.
Why not simply require the developer to specify the root term?
For example, if root is "items": [{}], then the opening statement is {{#items}}.
Then, if there are properties on a target page, one would target them as follows:
{{#items}}{{#Properties}}{{CID}}{{/Properties}}{{/items}}
Alternatively, if the root term is PropertyTable, then the statement would be as follows:
{{#PropertyTable}}{{#Properties}}{{CID}}{{/Properties}}{{/PropertyTable}}
Of course the JSON file with the root terms PropertyTable would have to be a valid array, as follows:
{
"PropertyTable": {
"Properties": [
{
"CID": 2244,
"MolecularFormula": "C9H8O4"
}
]
}
}
Is there a systematic problem with this approach?
We have used
amp-listandamp-mustachesuccessfully in several situations.However, the requirement that the root term is
"items":[{}]is limiting and basically requires full edit control of the target JSON file.Example:
Here's our proposal:
Require the developer to specify the root term when reading a HTTPS/CORS/JSON document.
A developer already has to specify tree navigation with a series of open and close (# and /) statements.
Why not simply require the developer to specify the root term?
For example, if root is
"items": [{}], then the opening statement is{{#items}}.Then, if there are properties on a target page, one would target them as follows:
{{#items}}{{#Properties}}{{CID}}{{/Properties}}{{/items}}Alternatively, if the root term is PropertyTable, then the statement would be as follows:
{{#PropertyTable}}{{#Properties}}{{CID}}{{/Properties}}{{/PropertyTable}}Of course the JSON file with the root terms PropertyTable would have to be a valid array, as follows:
Is there a systematic problem with this approach?