• Resolved andreas91

    (@andreas91)


    Hi there,

    Thanks for a great plugin.

    I am struggling to output the following json code, specifically the “items[].price” of both items using the following and its not working.

    Shortcode encapsulated in [jsoncontentimporter]:
    {subloop-array:items:-1}
    {subloop:items[].price:-1}
    {/subloop:items[].price}
    {/subloop-array:items}

    JSON:
    {
    “version”: 1,
    “modified”: “2022/08/30 09:04:10 PM”,
    “last request”: “2022/08/30 09:10:57 PM”,
    “hits”: 1,
    “notice”: “”,
    “items”: [
    0 : {
    code: 3p-MD
    price: 7799
    }
    1 : {
    code: AA-AXEOM
    price: 8999
    }
    ]
    }

    Result:
    result of parsing is empty: no data to be displayed.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author berkux

    (@berkux)

    Hi Andreas,

    try this:

    [jsoncontentimporter url=...]
    {last request} - {subloop-array:items:-1}
    {items.code} - 
    {/subloop-array:items}
    [/jsoncontentimporter]

    Bernhard

    Thread Starter andreas91

    (@andreas91)

    Thank you Bernhard, that did work.

    Can I have multiple subloop-arrays inside an html table like this:

    <tr>
    {subloop-array:items:-1}<td>{items.code}</td>{/subloop-array:items}
    {subloop-array:items:-1}<td>{items.qty_cpt}</td>{/subloop-array:items}
    {subloop-array:items:-1}<td>{items.qty_jhb}</td>{/subloop-array:items}
    {subloop-array:items:-1}<td>{items.qty_dbn}</td>{/subloop-array:items}
    {subloop-array:items:-1}<td>{items.qty_els}</td>{/subloop-array:items}
    </tr>
    Plugin Author berkux

    (@berkux)

    or this way:

    <table border=1>
    [jsoncontentimporter url=https://api.json-content-importer.com/extra/json/andreas91.json]
    {subloop-array:items:-1}
    <tr><td> 
    {items.code} - {items.price}
    </td></tr>
    {/subloop-array:items}
    [/jsoncontentimporter]
    </table>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Array loop issue displaying’ is closed to new replies.