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 JCI:

[jsoncontentimporter url=http://api.json-content-importer.com/extra/json/number.json]num: {num}, str: {str}[/jsoncontentimporter]

Free JCI in Action:
Note the missing 0 for the value of “num”

num: 3.505, str: 3.4040

PRO JCI:

To “save” the 0 you need the PRO plugin – unfortunately: There “convertjsonnumbers2strings=yes” converts the JSON to do this.

JCI-Shortcode:

[jsoncontentimporterpro nameoftemplate="twig-numbers" convertjsonnumbers2strings=yes]

JCI-Template:

  • URL: see above
  • twig-template:
{{num}} {{str}}

PRO in action:

3.5050 3.4040

PRO & free: API daten.buergernetz.bz.it

Challenge: Display data from the API http://daten.buergernetz.bz.it/services/weather/bulletin?format=json&lang=de

local stored JSON: http://api.json-content-importer.com/extra/json/daten.buergernetz.bz.it.json

Free Plugin:

[jsoncontentimporter url=http://daten.buergernetz.bz.it/services/weather/bulletin?format=json&lang=de]
{date}<br> 
{subloop:today:-1}<br> {today.title}<br> {subloop-array:today.stationData:-1}<br> {subloop:today.stationData.symbol:-1} <br> {today.stationData.symbol.description}: {today.stationData.min}-{today.stationData.max}<br> {/subloop:today.stationData.symbol} <br> {/subloop-array:today.stationData} <br> {/subloop:today} <br> 
[/jsoncontentimporter]

PRO JCI-Plugin:

  • twig-template:
{{today.date | date('d.m.Y, H:i:')}}: {{today.conditions}}<br>
{{today.temperatures}}<br>
{% for s in today.stationData %}
Station {{loop.index}}, code: {{s.symbol.code}}: {{s.min}}-{{s.max}} <img src="{{s.symbol.imageUrl}}"><hr>
{% endfor %}
<hr>Pick the 3rd station in the list:
 code: {{today.stationData.3.symbol.code}}: {{today.stationData.3.min}}-{{today.stationData.3.max}}  

PRO JCI Plugin in action:

05.02.2022, 00:00:: Anfangs streift eine schwache Kaltfront die Alpennordseite, im Tagesverlauf wird die Luft wieder trockener.
Die Höchstwerte liegen zwischen 3° bis 13°.
Station 1, code: a: -2-9
Station 2, code: a: -1-13
Station 3, code: a: -2-11
Station 4, code: b: -4-6
Station 5, code: a: -3-8
Station 6, code: b: -7-4

Pick the 3rd station in the list: code: b: -4-6

Free: Show Data with subloop-array

Challenge:

Show data from http://api.json-content-importer.com/extra/json/PareStranoit.json


Shortcode:


[jsoncontentimporter url=http://api.json-content-importer.com/extra/json/PareStranoit.json]
totalResults: {totalResults}
{subloop-array:entry:-1}
entry.championship_name: {entry.championship_name}
{subloop-array:entry.standing:-1}entry.standing.team_name: {entry.standing.team_name}{/subloop-array:entry.standing}
{/subloop-array:entry}
[/jsoncontentimporter]

In Action:


totalResults: 2

entry.championship_name: Regular Season Serie A2 Credem Banca – Girone Bianco
entry.standing.team_name: Synergy Arapi F.lli Mondovì
entry.standing.team_name: Monini Spoleto


Free: API NASA Open API

This pages shows you how to work with the NASA Open API:
Get your API-Key at https://api.nasa.gov and you get access to NASA data.
Example:

https://api.nasa.gov/planetary/apod?api_key=...

Local stored JSON: http://api.json-content-importer.com/extra/json/nasa-apod.json

Shortcode:

[jsoncontentimporter url=http://api.json-content-importer.com/extra/json/nasa-apod.json]
<img src="{hdurl}" width=300 align=left hspace=10>{title} - {date}<br>{explanation}
[/jsoncontentimporter]

In Action:


A Solar Prominence from SOHO – 2022-01-30
How can gas float above the Sun? Twisted magnetic fields arching from the solar surface can trap ionized gas, suspending it in huge looping structures. These majestic plasma arches are seen as prominences above the solar limb. In 1999, this dramatic and detailed image was recorded by the Extreme ultraviolet Image Telescope (EIT) on board the space-based SOHO observatory in the light emitted by ionized Helium. It shows hot plasma escaping into space as a fiery prominence breaks free from magnetic confinement a hundred thousand kilometers above the Sun. These awesome events bear watching as they can affect communications and power systems over 100 million kilometers away on planet Earth. In late 2020 our Sun passed the solar minimum of its 11-year cycle and is now showing increased surface activity.

Free: API www.veterans.gc.ca

1917-08-08 00:00:00.0: 19860, James Cotter
1918-08-08 00:00:00.0: 25949, William Jennings
1918-08-08 00:00:00.0: 25972, William John King

Gutenberg-Block using these settings:

{subloop-array:days:3}
{DATE_OF_DEATH}: {CASUALTY}, {FORENAMES} {SURNAME}<br>
{/subloop-array:days}

JCI-Template:

[jsoncontentimporter url=https://www.veterans.gc.ca/xml/jsonp/app.cfc?method=remoteGetHonourRoll&amp;language=en]{subloop-array:days:-1}
{DATE_OF_DEATH}: {CASUALTY}, {FORENAMES} {SURNAME}<br>
{/subloop-array:days}[/jsoncontentimporter]

Free: Basic JCI-Gutenberg-Block usage

Task, Show some weathedata on a page with the JCI-Gutenberg-Block

Load Gutenberg-Block “JSON Content Importer FREE” e .g. by searching the Blocks by “json”:

stationID: {stationID}}<br>
neighborhood: {neighborhood}
{subloop:metric:-1}
Station: {metric.stationID}<br>
Ort: {metric.neighborhood}<br>
Luftfeuchtigkeit: {metric.humidity} %<br>
Temperatur: {metric.temp} °C<br>
Taupunkt: {metric.dewpt} °C<br>
Wind: {metric.windspeed} km/h<br>
Windboen: {metric.windgust}km/h<br>
Luftdruck: {metric.pressure} hpa<br>
Niederschlag: {metric.precipRate} mm<br>
{/subloop:metric}

In Action:

stationID: IARGEN42}
neighborhood: EisenharzStation:
Ort:
Luftfeuchtigkeit: %
Temperatur: 22 °C
Taupunkt: 13 °C
Wind: 0 km/h
Windboen: 0km/h
Luftdruck: 1013.88 hpa
Niederschlag: 0 mm

Free: API 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=..


See how the free JSON Content Importer Plugin can use with the static JSON-Feed http://api.json-content-importer.com/extra/api/openweather.json:

Shortcode:

[jsoncontentimporter url=http://api.json-content-importer.com/extra/api/openweather.json]
Location: <a href="https://www.google.com/maps/search/{subloop:coord:-1}{coord.lat},{coord.lon}{/subloop:coord}">{name}</a> wind: 
{subloop:wind:-1}speed: {wind.speed}, deg: {wind.deg}{/subloop:wind}
{subloop:main:-1}humidity: {main.humidity}{/subloop:main} 
{subloop-array:weather:-1} {weather.main}, {weather.description} icon: <img src="http://openweathermap.org/img/wn/{weather.icon}@2x.png" title="{weather.main}: {weather.description}"> {/subloop-array:weather}
 [/jsoncontentimporter]

In Action:


Location: London
wind: speed: 4.1, deg: 80
humidity: 81

Drizzle, light intensity drizzle
icon:

Free Plugin: api.wordpress.org/events with Gutenberg-Block

With http://api.wordpress.org/events/1.0/?latitude=47.496&longitude=8.226 you can display the next WordPress-Events arround a geoposition. This can be displayed with the free plugin this way:

Create a new page with Gutenberg active. Insert the above URL into the Blocks API-URL. The “basenode” is “events”.
The template is:

<a href={url} target=_blank>{title}</a><br>{date}
<br>{subloop:location:-1}
<a href=https://www.google.com/maps?q={location.latitude}+{location.longitude}targt=_blank>{location.location}</a><hr>
{/subloop:location}

 

Screenshot of the Block-Settings:

Example in Action: Additional set “Number of json-top-level-items to display” to 2.

If you want to format the date you need the pro plugin.

In Action via Gutenberg-Block: