Skip to content

A Craft CMS Twig Extension for reading local JSON file or directly through URL.

License

Notifications You must be signed in to change notification settings

hdytsgt/Twigson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twigson

A Craft CMS Twig Extension for reading local JSON file or directly through URL.

Installation

  1. Download ZIP and unzip file then place the twigson directory into your craft/plugins directory.

  2. Install the plugin through Control Panel under Settings > Plugins

Usage

  1. Using local JSON file :

    {% set json = './countries.json' | twigson %}
    
    {% for key, item in json %}
    
       {{ key }} : {{ item }}
       
    {% endfor %}

    This will find countries.json under your Craft root folder. And of course you can pass absolute path too.

  2. Using URL :

    {% set json = 'http://yoursite.com/countries.json' | twigson %}
    
    {% for key, item in json %}
    
       {{ key }} : {{ item }}
       
    {% endfor %}

Related Project

TwigsonBundle for Symfony

License

MIT

About

A Craft CMS Twig Extension for reading local JSON file or directly through URL.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages