Hey there, Awesome Customers!

Just a heads up: We'll be taking a breather to celebrate International Workers' Day (May 1st and 2nd - Wednesday and Thursday) and Orthodox Easter from Good Friday (May 3rd) through Easter Monday (May 6th). So, from May 1st to May 6th, our team will be off enjoying some well-deserved downtime.

During this time, our customer support will be running on a smaller crew, but don't worry! We'll still be around to help with any urgent matters, though it might take us a bit longer than usual to get back to you.

We'll be back in action at full throttle on May 7th (Tuesday), ready to tackle your questions and requests with gusto!

In the meantime, you can explore our documentation for Amelia and wpDataTables. You'll find loads of helpful resources, including articles and handy video tutorials on YouTube (Amelia's YouTube Channel and wpDataTables' YouTube Channel). These gems might just have the answers you're looking for while we're kicking back.

Thanks a bunch for your understanding and support!

Catch you on the flip side!

Warm regards,

TMS

Okay
  Public Ticket #3591534
Nested JSON
Closed

Comments

  • Michael Montefusco started the conversation

    Thanks so much for making those great YouTube videos!!!


    Is there a way to build a relational database from the responses from an API request using a foreign key and all that?

    This can be a tremendous tool, but ideally I'd like to add a couple columns that are not accessible at the root I need to use. 

    I would love to know if this is possible somehow. Thanks!

  •  1,692
    Miloš replied

    Hi Michael,

    Apologies for the delayed reply, it is due to our non working weekends, which adds another couple days to the waiting time.

    Thank you for your patience.



    Sorry to disappoint you, but at this time, we don't have any built-in solution to achieve a Foreign Key Relation for any Table types which are not SQL Based Tables ( Manual Tables or SQL Query Tables).


    So it is not possible to add a Foreign Key Column to any non-server-side Tables, such as linked to JSON and similar Table types.


    You can suggest it to our developers, though - they will do their best to make a solution in the future, but i can't say a realistic ETA when it might become possible.

    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.

    -


    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    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

  •  1,692
    Miloš replied


    Hi Michael,

    Sorry - i just forgot to add, since you mentioned using some Fields which are not in the 'root' that was selected.


    We can only select one root at a time for any Nested JSON Table, but I will share this additional information in case if you haven't already seen it on our Documentation or YouTube Videos, in terms if you need to go 'one level deeper from the initial root'.

    As our developers pointed out in this example on our Documentation,

    if we only choose up to the first level deep in the JSON roots, such as "root>results",

    then it works without any additional step needed.

    4328952292.png

    There is this part of the Documentation beneath the example, where our devs stated :

    Please note: The root path that is chosen, needs to have the same object with the same keys and values as you can see for chosen path “root->results”. 

    If values are not a string, then those values will be skipped by default.

     In this case keys “films”, “vehicles”, “starships”, and “species” have values as arrays (in some cases they can be objects) and they will not be shown. 

    If you need to show data from those arrays as well, there is an option with a hook.

    So, when one of the 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

    Please check more details explained about this on this Documentation Page,

    find the title as "Use hooks to parse one more level deep in root path".

    4754281349.png

    There you will find the detailed explanation how you can use this hook to access one more leel deep in your JSON root path.

    Please note that using hooks requires certain level of programming skills and included support refers only to advice.


    I hope this helps ( if you already knew that part, my apologies).


    Let us know if you have additional questions about this.

    Thank you.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    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

  • Michael Montefusco replied

    OK. That is helpful. Would there be any means where I can change a UNIX timestamp into a human readable date to display in my table?

    Stripe always sends their dates as UNIX timestamps and this would be amazing if there were any way to show the date in something more user friendly.

  •  1,692
    Miloš replied

    Hi Michael,

    My apologies for all the waiting time.

    I checked, and sorry to disappoint you, but if you wish to change how this data is presented coming from a JSON data source ( or API as Nested JSON);

    for tables linked from live source data such as that - we do not have any editable functionalities, so the Plugin will only pull any value exactly as it is coming from the source data.


    2. The only way to convert UNIX timestamp to human readable Date data ( or DateTime data/depending what is needed) can be done via Custom SQL Queries.

    For example, as this Guide shows ( I will just copy one part from it that shows the relevant SQL function that converts the timestamp) :

    "MySQL has the FROM_UNIXTIME() function, which enables us to return a date representation of a Unix timestamp. Therefore, it’s as easy as calling the function with the Unix timestamp:

    SELECT FROM_UNIXTIME(1947172351);

    Result:

    2031-09-14 17:12:31

    It’s possible to pass a second argument to specify the format of the output. See FROM_UNIXTIME() Examples – MySQL for an example".


    So, if you change to working with an SQL Database as the Data source, then you could cast timestamps as Date data to have it more humanly readable;

    and that needs to be done directly on your Database source via your chosen Database Management Tool ( e.g. PhPMyAdmin);

    If you plan to use the Date Column type in our Plugin from an SQL Query, though, just note this limitation from the Documentation :

    When you’re working with MySQL, please cast timestamps, and datetime columns as dates only to avoid problems.




    3. When it comes to data from an API, such as JSON/ or Nested JSON, it seems there might be some workaround solutions online, but I can't guarantee it - for example you can check out Pages like this one :

    Handling Unix timestamps in JSON;

    or this Post from Stack Overflow : Convert unix timestamp to normal Date in Json;

    but manipulating your source Data to convert from UNIX to regular Date Data is not covered by our Support and we haven't had much experience with something like that;

    for our examples, we usually use some 'standard/ or free' API sources which are already having the data as we need it, if that makes sense.


    I hope that might help at least to start you in the right direction.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    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