Title: Is sorting possible?
Last modified: September 14, 2016

---

# Is sorting possible?

 *  Resolved [chuyqwerty](https://wordpress.org/support/users/chuyqwerty/)
 * (@chuyqwerty)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/is-sorting-possible/)
 * Hi, I installed your plugin yesterday and I was wondering if I am able to sort
   the results by a specific value. Here is the json:
 *     ```
       {
           "duel_id": 2,
           "name": "john",
           "xp": 5214,
           "level": 8,
           "xp_percentage": 0.56247,
           "games": 12,
           "wins": 6,
           "champions": [
               {
                   "champions_id": 25,
                   "champions_name_key": "hero",
                   "damagedealt": "317",
                   "damagetaken": "458",
                   "matchtime": 612,
                   "games": 98,
                   "wins": 2,
                   "xp": 234,
               },
           ],
       }
       ```
   
 * I got the plugin to spit out the values fine, but it is sorting by the champions_id
   from highest to lowest. I want to be able to sort the champions_id using wins
   or games or matchtime. How would I go about doing that? This is what my current
   shortcode looks like:
 *     ```
       			[jsoncontentimporter url='myapiurlandkey']
       			{subloop-array:champions:3}
   
       			<h2 class='widget-title'>{champions.champion_name_key}</h2>
       			<strong>Damage Dealt: </strong>{champions.damagedealt}
       			<strong>Damage Taken: </strong>{champions.damagetaken}
       			<strong>Matchtime: </strong>{champions.matchtime}
       			<strong>Games Played: </strong>{champions.games}
       			<strong>Wins: </strong>{champions.wins}
       			<strong>XP: </strong>{legends.xp}
       			{champions.xp_percentage}
       			<strong>Level: </strong>{champions.level}
   
       			{/subloop-array:champions}
       			[/jsoncontentimporter]
       ```
   
 * By the way, is there a way I can convert the matchtime from seconds to hours/
   minutes?
    Any help would be appreciated.
 * Thanks

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [berkux](https://wordpress.org/support/users/berkux/)
 * (@berkux)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/is-sorting-possible/#post-8195016)
 * Hi [@chuyqwerty](https://wordpress.org/support/users/chuyqwerty/),
 * the features you like to use are available in the pro-version by using the twig
   template-engine:
    1. sorting: [http://twig.sensiolabs.org/doc/filters/sort.html](http://twig.sensiolabs.org/doc/filters/sort.html)
 * 2. matchtime from seconds to hours/minutes:
    [http://twig.sensiolabs.org/doc/filters/date.html](http://twig.sensiolabs.org/doc/filters/date.html)
 * Bernhard
 *  Plugin Author [berkux](https://wordpress.org/support/users/berkux/)
 * (@berkux)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/is-sorting-possible/#post-8195045)
 * I checked it by this:
    [jsoncontentimporterpro url=”[http://wptest.kux.de/extra/json/chuyqwerty.json&#8221](http://wptest.kux.de/extra/json/chuyqwerty.json&#8221);
   parser=twig]xp: {{xp}}, xp_percentage: {{xp_percentage}}<hr> {% for ch in champions
   |reverse(champions_id) %} champions_id: {{ch.champions_id}}: champions.matchtime:{{
   ch.matchtime}} ({% set mt_min= (ch.matchtime/60)|round %}min: {{mt_min}} sec:{{
   ch .matchtime-60*mt_min}}) <hr> {% endfor %} [/jsoncontentimporterpro]

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Is sorting possible?’ is closed to new replies.

 * ![](https://ps.w.org/json-content-importer/assets/icon-256x256.png?rev=3464653)
 * [Get Use APIs - JSON Content Importer](https://wordpress.org/plugins/json-content-importer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/json-content-importer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/json-content-importer/)
 * [Active Topics](https://wordpress.org/support/plugin/json-content-importer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/json-content-importer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/json-content-importer/reviews/)

## Tags

 * [sort](https://wordpress.org/support/topic-tag/sort/)
 * [sorting](https://wordpress.org/support/topic-tag/sorting/)

 * 2 replies
 * 2 participants
 * Last reply from: [berkux](https://wordpress.org/support/users/berkux/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/is-sorting-possible/#post-8195045)
 * Status: resolved