Skip to content

proposal for amp-list and amp-mustache #3554

@jaygray0919

Description

@jaygray0919

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:

  {
    "items":
      [
        {

        }
      ]
  }

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions