Numbers and Strings in free and PRO plugin

Numbers and Strings:
See this JSON:
{"num": 3.5050, "str": "3.4040" }

There is a little difference: “num” is without quotation marks, “str” is with. The JSON Content Importer Plugin and the PHP behind that handles the “num” as numeric data and removes the 0 at the end.
Free jsoncontentimporter:
[jsoncontentimporter url=http://api.json-content-importer.com/extra/json/number.json]num: {num}, str:  {str}[/jsoncontentimporter]

gives us this:
num: 3.505, str: 3.4040
To “save” the 0 you need the PRO plugin – unfortunately: There “convertjsonnumbers2strings=yes” converts the JSON to do this.
[jsoncontentimporterpro url=http://api.json-content-importer.com/extra/json/number.json convertjsonnumbers2strings=yes  parser=twig]
{{num}} {{str}}[/jsoncontentimporterpro]

gives us this:
num:3.5050, str:3.4040

PRO JCI Plugin and the API of openweathermap.org

The API of openweathermap.org gives Feeds like https://samples.openweathermap.org/ and inside that JSON like https://samples.openweathermap.org/data/2.5/weather?q=London&appid=…

This can be used by the PRO JSON Content Importer Plugin for searching the weather:

For that you need a Shortcode and a JCI-Template.


1. The Shortcode:

Continue reading “PRO JCI Plugin and the API of openweathermap.org”

Free JCI Plugin: Data from playlist with basenode and without

JSON: https://cast02.siamsa.ie/public/radio_siamsa/api/live/nowplaying/radio_siamsa
Solution:
[jsoncontentimporter url=https://cast02.siamsa.ie/public/radio_siamsa/api/live/nowplaying/radio_siamsa basenode=now_playing.song] {text}<img src={art}> [/jsoncontentimporter]
or:
[jsoncontentimporter url=https://cast02.siamsa.ie/public/radio_siamsa/api/live/nowplaying/radio_siamsa] {subloop:now_playing:-1} {subloop:now_playing.song:-1} {now_playing.song.text}<img src={now_playing.song.art}> {/subloop:now_playing.song} {/subloop:now_playing} [/jsoncontentimporter]

Books: Current Bestseller

With the free JSON Content Importer Plugin you can display the New York Times Bestseller-Booklist:

Code for that:
[jsoncontentimporter url=https://api.nytimes.com/svc/books/v3/lists/current/hardcover-fiction.json?api-key=YOUR_NYT_API_BOOK_KEY basenode=results] {list_name}<br>{subloop-array:books:-1}<img src="{books.book_image}" title="{books.title}" align="left" width="40" hspace="5"> {books.rank}. <a href="{books.amazon_product_url}" target="_blank">{books.title}</a><br>{books.description}<br clear="all"> <hr>{/subloop-array:books} [/jsoncontentimporter]


In action:

Hardcover Fiction
1. THE MIDNIGHT LIBRARY
Nora Seed finds a library beyond the edge of the universe that contains books with multiple possibilities of the lives one could have lived.


2. THE MAID
When a wealthy man is found dead in his room, a maid at the Regency Grand Hotel becomes a lead suspect.

3. THE LINCOLN HIGHWAY
Two friends who escaped from a juvenile work farm take Emmett Watson on an unexpected journey to New York City in 1954.

4. THE HORSEWOMAN
As the Paris Olympics draw near, a mother and daughter, who are champion horse riders, compete against each other.

5. ONE STEP TOO FAR
The second book in the Frankie Elkin series. Frankie searches for a young man who went missing during a bachelor party camping trip.

6. THE LAST THING HE TOLD ME
Hannah Hall discovers truths about her missing husband and bonds with his daughter from a previous relationship.

7. THE JUDGE'S LIST
The second book in the Whistler series. Investigator Lacy Stoltz goes after a serial killer and closes in on a sitting judge.

8. THE STRANGER IN THE LIFEBOAT
After a ship explodes, 10 people struggling to survive pull a man who claims to be the Lord out of the sea.

9. WISH YOU WERE HERE
Diana O’Toole re-evaluates her seemingly perfect life when a pandemic disrupts her vacation in the Galápagos Islands.

10. TO PARADISE
Difficult circumstances and societal pressures affect characters living in America in 1893, 1993 and 2093.

11. CALL US WHAT WE CARRY
A debut collection of poems on identity and history by the presidential inaugural poet who wrote “The Hill We Climb.”

12. CLOUD CUCKOO LAND
An interconnected cast of dreamers and outsiders are in dangerous and disparate settings past, present and future.

13. SOMETHING TO HIDE
The 21st book in the Inspector Lynley series. Lynley pursues a killer who might be hiding in North London's Nigerian community.

14. THE WISH
Maggie Dawes, a renowned travel photographer, struggles with a medical diagnosis over Christmas.

15. GO TELL THE BEES THAT I AM GONE
The ninth book in the Outlander series. As the Revolutionary War moves closer to Fraser’s Ridge, Claire and Jamie reunite with their daughter and her family.

JCI and casino.chompcasino.com

Challenge: Load https://casino.chompcasino.com/content/chomp-casino/json/2.1/manifest_multicurrency.json and display those game-items containing a defined title.

Solution: Create a new JCI-template with the following settings.
URL: https://casino.chompcasino.com/content/chomp-casino/json/2.1/manifest_multicurrency.json
urlparam4twig : t

Twig code in template:

{% set t = 'Mont' %}
{% if urlparam.t %}
{% set t = urlparam.t %}
{% endif %}
term: {{t}}<br>
{% for g in games if g.title matches '/'~t~'/i'  %}
title: {{g.title}}<br>
{% for i in g.images %}
{{i.url}}
{% endfor %}
<hr>
{% endfor %}

Create new page with this Shortcode: [jsoncontentimporterpro id=NUMBER_OF_JCI_TEMPLATE]

In Action:

Try also this: http://api.json-content-importer.com/jci-and-casino-chompcasino-com/?t=romance

term:Mont
title:Montezuma
/content/all/images/montezuma/banner.jpg/content/all/images/montezuma/tile.jpg

JCI and TablePress

The Plugin “TablePress” and the PRO version of the JSON Content Importer can work together in this way:

  1. Create a new TablePress-Table with e. g. two columns and two rows. Fill the cells with some dummy text. This gives you a shortcode [table id=NUMBER_OF_TABLEPRESS_TABLE].

  2. Create a new JCI-Plugin Template with e. g. some JSON data. The Twig-Code is

    name: {{_context.0.name}}
    [table id=NUMBER_OF_TABLEPRESS_TABLE /]
    
  3. Create a new WordPress-Page/Post with this shortcode:
    [jsoncontentimporterpro nameoftemplate=NAME_OF_JCI_TEMPLATE orderofshortcodeeval=2]
    

    Preview this page: You should see some “name”-Data and a Table.

  4. Then change the content of a Table-Cell and insert {{_context.0.name}} there.

  5. Preview again and you should see the JSON-data in the Table.

If the number of columns or rows is dynamic: Up to my knowledge TablePress has a fixed number of cols and rows. So this is not that flexible.
Maybe Table Sort is an option then.

JCI and Table Press in Action:

name:Love Breakfast
1a:Love Breakfast1b
2a2b