• Resolved ginowp

    (@ginowp)


    Hi, i’m new to json, finding my way bit by bit…

    In the plugin (Gutenberg) i was able to retrieve all the data i needed, thats’ ok, but one thing does not work:

    My template works well and
    <b>Link: </b>{links.backlink}<br/>
    gives the correct data.
    Only when i have two or more lines (links) seperated by commas, the plugin does not show anything. I would like to have only the firts line (the first URL)

    In JSON this :

    backlink:
    [
    https://lirias.kuleuven.be/handle/123456789/651696&#8221;,
    https://lirias.kuleuven.be/3000829&#8221;,

    How can i make that only the first URL line will be shown???

    Thanks!

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

    (@berkux)

    Hi,

    can you post the complete JSON, please.

    Bernhard

    Thread Starter ginowp

    (@ginowp)

    Shure – and thanks for looking into this!

    – This is the result-page: https://itec.kuleuven-kulak.be/?page_id=2707
    As you see, the item LINK is shown (in 1, 3 & 4) and is not shown in the others because there is more than one link in the json ‘baclink’;

    This is what i put into the Gutenberg block:

    API-URL: https://services.libis.be/search?query=user:U0006844&institution=lirias
    basenode: data
    template:

    • {subloop:display:-1}
      {subloop:links:-1}

      {display.creator} –
      {display.creationdate} –
      <b>{display.title}</b>
      {display.ispartof} –
      {display.source_id}
      <br>
      <b>LINK</b>: {links.backlink}
      <br>
      {/subloop:links}
      {/subloop:display}
      <p>

      And this is the shortcode:

      [jsoncontentimporter url=https://services.libis.be/search?query=user:U0006844&institution=lirias numberofdisplayeditems=-1 basenode=data urlgettimeout=5 debugmode=10 ]

    • {subloop:display:-1}
      {subloop:links:-1}

      {display.creator} –
      {display.creationdate} –
      <b>{display.title}</b>
      {display.ispartof} –
      {display.source_id}
      <br>
      <b>LINK</b>: {links.backlink}
      <br>
      {/subloop:links}
      {/subloop:display}
      <p>
      [/jsoncontentimporter]

    Plugin Author berkux

    (@berkux)

    <<As you see, the item LINK is shown (in 1, 3 & 4) and is not shown in the others because there is more than one link in the json ‘baclink’;>>
    Ok, this is due to inconsitent JSON.
    If there is only one backlink it’s encoded as object, if there are more than 1 as array.
    This is fatal for the free parser.
    Even the PRO version of the plugin can handle this only with checking if “backlink” iterable or not.
    The best way would be that the JSON is improved and this is always a array.

    Bernhard

    • This reply was modified 6 years, 1 month ago by berkux.
    Thread Starter ginowp

    (@ginowp)

    Ok, i understand, problem is we recieve this JSON file and cannot edit it.

    Could this be a solution?

    – we can axtract the source_id, and that is always LIRIAS########
    – the link we need is always https://lirias.kuleuven.be/########
    – is there a way we can extract the ######## from the source_id (or elemintte LIRIAS) and add it to https://lirias.kuleuven.be/#########

    That would be a solution to have the correct link that we need….

    **And another question: for formatting a date (20200430) we need the PROversion?

    Thanks a lot for the service!

    Plugin Author berkux

    (@berkux)

    <<is there a way we can extract the ######## from the source_id>>
    The plugin with the free parser unfortunaltely can’t do that.

    <<for formatting a date (20200430) we need the PROversion? >>
    yes

    With the pro version this JSON is no problem.
    Another solution would be to ask the API-supplier to change or add the JSON.

    Bernhard

    Thread Starter ginowp

    (@ginowp)

    thanks!
    so that means that the PRO version can extract the number…

    Gino

    Plugin Author berkux

    (@berkux)

    you have to switch to
    https://jsoncontentimporter.freshdesk.com/widgets/feedback_widget/new?searchArea=no
    for any questions about the pro plugin, sorry

    Bernhard

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Values with comms not showing’ is closed to new replies.