Calc with data from 2 JSON-URLs

Your challenge: You have 2 JSON-URLs/APIs. You want to bring together these 2 and calculate with data out of both JSON-datasources.

The solution: Put both JSON-URLs/APIs (completely or only needed parts of it) into one JSON and calculate.

This is done by the PRO-version of the JSON Content Importer Plugin in this way:

  1. Create a new entry in the plugins template-manager as JSON-styled template for the 1st JSON:
    JSON-URl-1 (put this into template-manager entry):
    http://api.json-content-importer.com/extra/json/n1.json

    Template-Code:
    ,{“json2”: {“no2”:{{no2}} } }

    Name the template like “calc1” or something….

    Remember the no of this template.
  2. Create a 2nd new entry in the plugins template-manager as JSON-styled template containing a nested-shortcode of the plugn to get the 2nd JSON.
    Example:
    JSON-URl-1 (put this into template-manager entry):
    http://api.json-content-importer.com/extra/json/n2.json

    Template-Code:
    {“json”:[{“json1”: {“no1”:{{no1}} }} [jsoncontentimporterpro parser=twig id=NUMBER_OF_TEMPLATE_FROM_STEP1] ]}
    “NUMBER_OF_TEMPLATE_FROM_STEP1” is the template-manager-no of the frist created template.

    Name the template like “calc2” or something….

    Remember the no of this template.
  3. Create a new page with that shortcode:
    [jsoncontentimporterpro parser=twig id=NUMBER_OF_TEMPLATE_FROM_STEP2] and publish this page.

    In the example the page is named “multiply” and http://api.json-content-importer.com/multiply/?show=oc shows valid JSON-data.
    If there are <p> in this JSON (see sourcecode in browser for that): Switch off wpautop at the Pluginoptions>Settings>”Use wpautop or not” by selecting “remove wpautop”
  4. Create another new template-manager entry:


    json1: {{json[0].json1.no1}}
    json2: {{json[1].json2.no2}}
    multiply: {{json[0].json1.no1 * json[1].json2.no2}}


    and URL: http://api.json-content-importer.com/multiply/?show=oc

    Name the template like “calc3” or something….

    Remember the no of this template.
  5. Create another new page with that shortcode:
    [jsoncontentimporterpro parser=twig id=NUMBER_OF_TEMPLATE_FROM_STEP3]

In action:

json1: 8
json2: 5
multiply: 40