• Resolved SimonDorfman

    (@simondorfman)


    [jsoncontentimporter url="https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd" debugmode="10" basenode=""]{current_price}[/jsoncontentimporter]

    Above code gets the current_price for every id in the JSON. I want to get the current_price when the id=’ethereum’. If I were writing a JSON selector, it would look like this:

    [1]['current_price']

    I can’t figure out how to translate that into the syntax JSON Content Importer is using. I want it to just return one number, not a bunch of numbers.

    Instead of {current_price}, what should I use?

    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,
    try this:

    [jsoncontentimporter url=https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd oneofthesewordsmustbein=ethereum oneofthesewordsmustbeindepth=2 oneofthesewordsmustnotbein=ethereum-classic oneofthesewordsmustnotbeindepth=2 ]{id}: {current_price}
    {subloop:status:-1}{status.error_message}{/subloop:status}[/jsoncontentimporter]

    Bernhard

    • This reply was modified 3 years ago by berkux.
    Thread Starter SimonDorfman

    (@simondorfman)

    That works perfectly. Thanks, @berkux !

    Plugin Author berkux

    (@berkux)

    Great! Feel free to add a review at https://ww.wp.xz.cn/support/plugin/json-content-importer/reviews/
    That would be very nice.
    Bernhard

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

The topic ‘Return field when another field matches string’ is closed to new replies.