JCI-template engine: castlist JSON-Example

wordpress.org Member castlist from UK asked for help: His challange is to display some JSON with the JCI-plugin on a wordpress-site.
How he should do this?

Step 1: Check JSON

  1. Check the JSON data: Display the JSON-data in a browser
  2. Copy the JSON-data (e.g. Strg+A on Windows) to the clipboard of your local system.
  3. Open http://jsonviewer.stack.hu/ in your browser and copy the JSON to the text-form of the website (win: Shift+Insert).
  4. Change from “text” to “JSON”: The website shows you the structure of the JSON.

Step 2: Build Shortcode for JCI-Plugin (free version)

  1. basic setup: jsoncontentimporter url=”http://json-content-importer.com/extra/json-examples/1.json”
  2. template: {type}
  3. together:
    [jsoncontentimporter url=”http://json-content-importer.com/extra/json-examples/1.json”]{type}[
    result is: cities
  4. access to “updated” data:
    use: {subloop:updated:-1}{updated.time}{/subloop:updated}
    together:
    [jsoncontentimporter url=”http://json-content-importer.com/extra/json-examples/1.json”]type: {type}
    {subloop:updated:-1}{updated.time}{/subloop:updated}[
    result is:
    type: cities
    2016-04-09T12:28:09+00:00
  5. access to “result-0-info-city” data:
    use: {subloop-array:result:-1}{subloop:result.info:-1}{subloop:result.info.city:-1}{result.info.city.name}{/subloop:result.info.city}{/subloop:result.info}{/subloop-array:result}
    together:
    [jsoncontentimporter url=”http://json-content-importer.com/extra/json-examples/1.json”]type: {type}
    {subloop:updated:-1}{updated.time}{/subloop:updated}
    city: {subloop-array:result:-1}{subloop:result.info:-1}{subloop:result.info.city:-1}{result.info.city.name}{/subloop:result.info.city}{/subloop:result.info}{/subloop-array:result}[
    result is:
    type: cities
    2016-04-09T12:28:09+00:00
    city: Amsterdam

Step 3: Advanced features of PRO-version

  1. template-manager:
    Store the template-text and the URL not on each page but on one place, the tempate-manager
  2. format the date: transfer “2016-04-09T12:28:09+00:00” to something like “4/9/16″:
    [jsoncontentimporterpro url=”http://json-content-importer.com/extra/json-examples/1.json”]date: {subloop:updated:-1}{updated.time:datetime,”m/d/Y H:i”,0}{/subloop:updated}[/jsoncontentimporterpro]
    result is:
    [jsoncontentimporterpro url=”http://json-content-importer.com/extra/json-examples/1.json”]date: {subloop:updated:-1}{updated.time:datetime,”m/d/Y H:i”,0}{/subloop:updated}[/jsoncontentimporterpro]
  3. use the twig-templateengine