Hey everyone!

With the holiday season upon us, we want to share our upcoming working hours:

After that, we’ll return to our regular schedule and assist you as quickly as possible.

In the meantime, you can explore our documentation for Amelia and wpDataTables. You'll find tons of helpful resources, including articles and handy video tutorials on YouTube (Amelia's YouTube Channel and wpDataTables' YouTube Channel), which might just have the answers you need while we’re away.

Thanks a bunch for your understanding and support!

Warm regards and happy holidays!

TMS

Okay
  Public Ticket #3413819
nested json
Closed

Comments

  • David started the conversation

    hello


    i have added the cal actions in functions.php but how get the table the data from one arry lower

    Use hooks to parse one more level deep in root path

    If one of chosen root path objects contains keys that have an array or objects as values and you need to include them in a table as cell values, then you can choose these two hooks:

    • wpdatatables_get_one_level_deep_json_data_from_array_as_string and
    • wpdatatables_set_one_level_deep_json_data_separator

    For the first hook that accepts 3 params

    • $deepParse – boolean – false by default,
    • $jsonURL – string – nested JSON URL ,
    • $tableID – int – id of the table

    you only need to provide a boolean value true, like in the example below:

    01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 /** * Parse one level deep in nested JSON structure * @param $deepParse * @param $jsonURL * @param $tableID * @return bool|mixed */ function parseNestedJSON($deepParse, $jsonURL, $tableID){        //use only for tables that have specific json url    if($jsonURL == 'https://swapi.dev/api/people'){       return true;    }      return $deepParse; }   add_action('wpdatatables_get_one_level_deep_json_data_from_array_as_string', 'parseNestedJSON',10,3);
  •  1,847
    Miloš replied

    Hi, David.

    Our support does not cover custom solutions such as this use-case.

    On our Documentation for using the Nested JSON, we pointed out this limitation :

    - The plugin allows you to choose what the “roots” for creating the table will be, but please note that you can only select one level within your JSON file to create a table.

    -

    For using hooks to parse one more level deep in the root path,

    we only have that example from the Documentation Page at this moment.

    -

    If you wish to see an easier option for this in the future,

    please feel free to search on our suggestions page

     to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there,  and as more people vote, the feature will move higher on the priority list.

    You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;

    and our newsletter, so you're informed about new features, bug fixes, freebies, etc.

    -

    If you have coding skills and wish to try to make a custom solution now,

    you can check out our available hooks for Developers on this documentation and see if you can find any hook that might help.

    Please be advised that custom solutions with hooks are not included in our support.

    You can also research resources such as Stack Overflow to see if any other user perhaps found a workaround.

    -

    Our developers made the example as you saw in the Documentation,

    but you will have to modify that example in order to create the solution for your specific use-case and your JSON data.

    I hope that helps.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables