Title: Display Array Values?
Last modified: August 22, 2016

---

# Display Array Values?

 *  Resolved [sactobla](https://wordpress.org/support/users/sactobla/)
 * (@sactobla)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/display-array-values/)
 * Great plugin that does what I need, but I can’t figure out how to display the
   values of an array, such as the one below. Can you help?
 *     ```
       "actions": [
         { "date": "2009-02-25 00:00:00",
          "action": "Read first time. To print.",
          "type": [ "bill:introduced", "bill:reading:1" ],
          "actor": "lower (Desk)" },
         { "date": "2009-02-26 00:00:00",
          "action": "From printer. May be heard in committee March 28.",
          "type": [ "other" ],
          "actor": "lower (Desk)" },
         { "date": "2009-03-23 00:00:00",
          "action": "Referred to Com. on HEALTH.",
          "type": [ "committee:referred" ],
          "actor": "lower (Committee CX08)" },
       ]
       ```
   
 * [https://wordpress.org/plugins/json-content-importer/](https://wordpress.org/plugins/json-content-importer/)

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

 *  Plugin Author [berkux](https://wordpress.org/support/users/berkux/)
 * (@berkux)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/display-array-values/#post-5711708)
 * Thank you for your post. I’ll check this.
 *  Plugin Author [berkux](https://wordpress.org/support/users/berkux/)
 * (@berkux)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/display-array-values/#post-5711712)
 * Ok, I can add this.
    How would you mask the datafield? Like {type:1} for the 
   first field of the array? Then {type:2}, {type:3} etc.?
 * So the shortcut-code would be like this:
    [jsoncontentimporter url=”[http://&#8230](http://&#8230);.
   json” basenode=”actions”] {date} {action} {actor} {type:1} {type:2} {type:3} 
   <hr> [/jsoncontentimporter]
 *  Thread Starter [sactobla](https://wordpress.org/support/users/sactobla/)
 * (@sactobla)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/display-array-values/#post-5711728)
 * Well (if you can’t tell 🙂 ) I’m a total novice. From a functional standpoint
   of how to craft a short code argument, that makes sense. The one issue/question
   I see is that, based on my research, it would need to somehow call each of the
   three objects in the array, so that it is displaying each of the records in the
   array separately. For example I have this code:
 *     ```
       {
       "object1": "data1",
        "another_object": "more data",
       "this_array_thing" : [
         { "date": "2009-02-25 00:00:00",
          "action": "Read first time. To print."},
         { "date": "2009-02-26 00:00:00",
          "action": "From printer. May be heard in committee March 28.",
           },
         { "date": "2009-03-23 00:00:00",
          "action": "Referred to Com. on HEALTH." },
       ]
       ```
   
 * I would want the display to look like this:
    Data1 – More data: -2009-02-25 00:
   00:00, Read First Time, To Print -2009-02-26 00:00:00, From Printer. May be Heard
   in Committee -2009-03-23 00:00:00, Referred to Com on HEALTH
 * Etc, with each record.
 * Would your suggestion accomplish that?
 *  Plugin Author [berkux](https://wordpress.org/support/users/berkux/)
 * (@berkux)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/display-array-values/#post-5711787)
 * Hi,
 * install
    [https://downloads.wordpress.org/plugin/json-content-importer.1.0.3.zip](https://downloads.wordpress.org/plugin/json-content-importer.1.0.3.zip)
   and
 * and:
    1. [http://reiseliste.de/extra/tmp/3.json](http://reiseliste.de/extra/tmp/3.json)
   shortocde: [jsoncontentimporter url=”[http://www.reiseliste.de/extra/tmp/3.json&#8221](http://www.reiseliste.de/extra/tmp/3.json&#8221);
   numberofdisplayeditems=”30″ basenode=””] obj: {object1}, anobj: {another_object}
 * {subloop-array:this_array_thing:5}dat:{date}, act: {action}
   {/subloop-array} [/
   jsoncontentimporter]
 * 2. [http://reiseliste.de/extra/tmp/2.json](http://reiseliste.de/extra/tmp/2.json)
 * shortocde:
    <table border=1> [jsoncontentimporter url=”[http://www.reiseliste.de/extra/tmp/2.json&#8221](http://www.reiseliste.de/extra/tmp/2.json&#8221);
   numberofdisplayeditems=”2″ basenode=”actions”] <tr><td>{date}</td><td>{action}
   </td><td>{actor}</td><td> {subloop-array:type:5}{1:ifNotEmptyAddRight:aabb}{2:
   ifNotEmptyAddLeft:AA}{3:ifNotEmptyAddRight:BB}{/subloop-array}</td></tr> [/jsoncontentimporter]
   </table>
 *  Thread Starter [sactobla](https://wordpress.org/support/users/sactobla/)
 * (@sactobla)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/display-array-values/#post-5711809)
 * Wow. Thanks for updating this to include this function. I can get the data to
   display when i use your example. However, when I try to display from a different
   data source, I can get objects to display fine but not the data within sub loop-
   array.
    The entire code is below. And when I do this the “committee” and “Id”
   fields display fine. However, after that it displays the actual code i.e. “subloop-
   array:members:5} {name} {/subloop-array}” in the page. So the result looks like
   this:
 * Standing Committee on Jobs, Economic Development, and the Economy ;CAC000329
   {
   subloop-array:members:5} {name} {/subloop-array}
 * What am I doing wrong?
 *     ```
       [jsoncontentimporter url="http://openstates.org/api/v1//committees/CAC000329/?apikey=4680b1234b1b4c04a77cdff59c91cfe7" numberofdisplayeditems="30" basenode=""]
       {committee} ;{id}
   
       {subloop-array:members:5} {name}
       {/subloop-array}
   
       [/jsoncontentimporter]
       ```
   
 *  Plugin Author [berkux](https://wordpress.org/support/users/berkux/)
 * (@berkux)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/display-array-values/#post-5711817)
 * subloop and subloop-array do not work here.
    but the solution is: use multiple[
   jsoncontentimporter]: each of it grabs and displays the part you need (with active
   caching the JSON-Url is fetched only once).
 * E.g. for [http://openstates.org/api/v1//committees/CAC000329/?apikey=4680b1234b1b4c04a77cdff59c91cfe7](http://openstates.org/api/v1//committees/CAC000329/?apikey=4680b1234b1b4c04a77cdff59c91cfe7)
 * [jsoncontentimporter url=”[http://openstates.org/api/v1//committees/CAC000329/?apikey=4680b1234b1b4c04a77cdff59c91cfe7″%5D](http://openstates.org/api/v1//committees/CAC000329/?apikey=4680b1234b1b4c04a77cdff59c91cfe7″%5D){
   committee}{chamber}{id}
    [/jsoncontentimporter] [jsoncontentimporter url=”[http://openstates.org/api/v1//committees/CAC000329/?apikey=4680b1234b1b4c04a77cdff59c91cfe7&#8243](http://openstates.org/api/v1//committees/CAC000329/?apikey=4680b1234b1b4c04a77cdff59c91cfe7&#8243);
   basenode=”sources”][{url:ifNotEmptyAdd:}](https://wordpress.org/support/topic/display-array-values/{url}?output_format=md)[/
   jsoncontentimporter] <hr> [jsoncontentimporter url=”[http://openstates.org/api/v1//committees/CAC000329/?apikey=4680b1234b1b4c04a77cdff59c91cfe7&#8243](http://openstates.org/api/v1//committees/CAC000329/?apikey=4680b1234b1b4c04a77cdff59c91cfe7&#8243);
   basenode=”members”] {name}: {leg_id}, {role}[/jsoncontentimporter]
 *  Thread Starter [sactobla](https://wordpress.org/support/users/sactobla/)
 * (@sactobla)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/display-array-values/#post-5711831)
 * Excellent. That worked! Thank you.
 *  Plugin Author [berkux](https://wordpress.org/support/users/berkux/)
 * (@berkux)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/display-array-values/#post-5711832)
 * you’re welcome.
    please do me a favour and rate the plugin. thank you
 *  [web_line](https://wordpress.org/support/users/web_line/)
 * (@web_line)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/display-array-values/#post-5711833)
 * How can I access the elements in this sample:
    … “aspects”: [ { “image”: { “retina”:“
   [http://myurl/wp-content/uploads/2014/11/SBK-08-Ansicht_001.jpg?820&#8221](http://myurl/wp-content/uploads/2014/11/SBK-08-Ansicht_001.jpg?820&#8221);,“
   size_retina”: 290444, “lastmodified”: 1416393176, “id”: 820 }, “text”: “Vogelperspektive”},{“
   image”: { …
 * I defined basenode=”aspects” and can access {text} – but how can I get “size_retina”?
   {
   subloop:image:} Size Retina: {size_retina} Will not work (it’s no array)….
 * Thanks a lot,
 * Detlef
 *  Plugin Author [berkux](https://wordpress.org/support/users/berkux/)
 * (@berkux)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/display-array-values/#post-5711834)
 * Hi Detlef,
 * mail JSON as File or URL,please:
    blog @ kux . de
 *  Plugin Author [berkux](https://wordpress.org/support/users/berkux/)
 * (@berkux)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/display-array-values/#post-5711835)
 * Hi Detlef,
 * see
    [http://kux.de/extra/json/somejson/6.json](http://kux.de/extra/json/somejson/6.json)
   Up to this version the plugin expects an object after “aspects”, not an array
   encapsulated by “[]”. In the next version the basenodeparameter will have an 
   number as attribute, e.g. “aspects:0” means select first array-item.
 * Bernhard
 *  Thread Starter [sactobla](https://wordpress.org/support/users/sactobla/)
 * (@sactobla)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/display-array-values/#post-5711839)
 * Will do. Also plan to make a donation to support further development. Keep it
   up.
 *  [web_line](https://wordpress.org/support/users/web_line/)
 * (@web_line)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/display-array-values/#post-5711841)
 * Hi Bernhard,
 * using your JSON sample with:
    [jsoncontentimporter url=”[http://kux.de/extra/json/somejson/6.json&#8221](http://kux.de/extra/json/somejson/6.json&#8221);
   numberofdisplayeditems=”3″ basenode=”aspects”] {text} {subloop:image:} Event:{
   retina} {/subloop} [/jsoncontentimporter]
 * I got:
 * Vogelperspektive
    Event: {retina}
 * {text}
    Event: {retina}
 * and a lot of “Undefined variable: subloopNode in …/json-content-importer/class-
   json-parser.php on line 90”
 * Detlef
 *  Plugin Author [berkux](https://wordpress.org/support/users/berkux/)
 * (@berkux)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/display-array-values/#post-5711848)
 * Hi Detlef,
 * thanks for sending me the JSON-Url via Mail. I’ll work on that.
 * Bernhard
 *  Plugin Author [berkux](https://wordpress.org/support/users/berkux/)
 * (@berkux)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/display-array-values/#post-5711863)
 * Hi Detlef,
 * thanks for mailing. I’ll send you details via mail.
    And: there is a new version
   1.1.0: [https://downloads.wordpress.org/plugin/json-content-importer.1.1.0.zip](https://downloads.wordpress.org/plugin/json-content-importer.1.1.0.zip)
 * Before I release it as “stable” I would be happy with some user-tests.
    New is
   the very much enhanced template-engine for supporting more JSON-structures.
 * Best
    Bernhard

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

The topic ‘Display Array Values?’ 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/)

 * 15 replies
 * 3 participants
 * Last reply from: [berkux](https://wordpress.org/support/users/berkux/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/display-array-values/#post-5711863)
 * Status: resolved