Free Plugin: 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

PRO: JSON meets JCI and jQuery for a facet-search

Selecting a hotel for oyur holiday depends on options like location and price. With a facet-search you select several locations out of the all available and define a range for the price. Then the matcihing hotels should be displayed.

This can be done with the JCI-PRO-Plugin which grabs the JSON-data, builds a facet and shows the selected data. See here for an example.

To build that you need a data-source (JSON-API), the JCI-PRO-Plugin, jQuery-Libraries (maybe part of your WordPress-template or loadable via JCI) and twig-Software für the facet and the results.

See here how this can be done.

PRO: geoserver.nottinghamcity.gov.uk/parking/defstatus.json

Challenge:
Show data from https://geoserver.nottinghamcity.gov.uk/parking/defstatus.json
Solution: PRO Plugin
Create a new JCI-Template with the above URL and this twig-code:
{% for c in carParks.carPark %}
{{c.definition.parkingRecord.parkingRecord.parkingNumberOfSpaces}} parkingNumberOfSpaces at 
{{ attribute(c.definition.parkingRecord.parkingRecord.parkingDescription.values.value, '#text') }} (id: {{ attribute(c, '@id') }})


parkingSiteStatus: {{c.status.parkingRecord.parkingRecordStatus.parkingSiteStatus }}
parkingSiteOpeningStatus: {{c.status.parkingRecord.parkingRecordStatus.parkingSiteOpeningStatus}}
measurementOrCalculationTime: {{c.status.parkingRecord.parkingRecordStatus.parkingOccupancy.vehicleCountAndRate.vehicleRate.measurementOrCalculationTime | date("d.m.Y, H:i") }}
fillRate: {{c.status.parkingRecord.parkingRecordStatus.parkingOccupancy.vehicleCountAndRate.vehicleRate.fillRate.vehicleFlowRate}}
exitRate: {{c.status.parkingRecord.parkingRecordStatus.parkingOccupancy.vehicleCountAndRate.vehicleRate.exitRate.vehicleFlowRate}}
{% endfor %}
Then use the Shortcode Continue reading “PRO: geoserver.nottinghamcity.gov.uk/parking/defstatus.json”

API: daten.buergernetz.bz.it with free and PRO Plugin

Challenge: Display data from the API http://daten.buergernetz.bz.it/services/weather/bulletin?format=json&lang=de
Free JCI-Plugin:
[jsoncontentimporter url=http://daten.buergernetz.bz.it/services/weather/bulletin?format=json&lang=de] <br>
{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:
Continue reading “API: daten.buergernetz.bz.it with free and PRO Plugin”

API: api.coinpaprika.com with free and PRO JCI-Plugin

Challenge:
Show data from https://api.coinpaprika.com/v1/exchanges/paribu?quotes=TRY
Solution with the free JCI-Plugin:
[jsoncontentimporter url=https://api.coinpaprika.com/v1/exchanges/paribu?quotes=TRY]
{subloop:quotes:-1}
{subloop:quotes.TRY:-1}
reported_volume_24h = {quotes.TRY.reported_volume_24h}
{/subloop:quotes.TRY}
{/subloop:quotes}
[/jsoncontentimporter]

In Action:
reported_volume_24h = 68503846.3082
Solution with the PRO JCI-Plugin:
Create a template with URL https://api.coinpaprika.com/v1/exchanges/paribu?quotes=TRY and this twig-code:
{% set lire = quotes.TRY.reported_volume_24h|split('.') %}
reported_volume_24h = {{lire.0 | formatnumber(0, '', ',') }}.{{lire.1}}

Store this JCI-Template and use it in a shortcode in this way:
[jsoncontentimporterpro id=_NO_OF_TEMPLATE convertjsonnumbers2strings=yes]

In Action:
reported_volume_24h = 68,503,846.30823986

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