0

My JSON data looks something like this:

{
    data:[
        [
            {"title": "Text1"},
            {"title": "Text2"},
            {"title": "Text3"}
        ],
        [
            {"title": "Text4"},
            {"title": "Text5"},
            {"title": "Text6"}
        ]
    ]
}

I want to use the data to generate a table. So far, I only manage to get it generate rows.

{#data}
    <tr>
      <td>{title}</td>
    </tr>
{/data}

How can I get it generate columns? Thanks.

1 Answer 1

1

You need to add an extra loop as each value in the first array is also an array:

{#data}
    <tr>
        {#.}
            <td>{.title}</td>
        {/.}
    </tr>
{/data}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.