JSON handling

  1. last year

    arminmon

    26 Jun 2016 User since 2016

    Hi,
    I just started using Creo and it's been awesome so far as newbie. I'm planning to build something like a news feed app in which the app will connect to a JSON link and read the data.
    I'd really appreciate it if someone could guide me through this; maybe with a pre-made example project.
    Thanks.

  2. steveharman

    27 Jun 2016 User since 2016
    Edited last year by steveharman

    Hi @arminmon

    What you describe sounds like a perfect use of Creo.

    Here's a tutorial on connecting to the Spotify REST API which returns JSON: http://blog.creolabs.com/2015/12/04/custom-view-and-real-data/ The endpoint in the example is https://api.spotify.com/v1/search/?q=adele&type=album to give you a flavor.

    But. You should be aware that at present it isn't possible to take contents from input fields in Creo and pass them to the http client's properties. So for example you couldn't have a "my search box" input field together with a search button that would take the contents of "my search box", perform a search against your news service and return results.

    This is 'dynamic properties' and if you hunt around the forum it has been scheduled for the next beta release. Similarly when you get results back into say a list-view or table, you will need to pass record IDs from your table into a detail screen so the detail screen knows which record(s) to display - @marco has kindly offered to do a blog post on how this can be done, around the time Creo b5 is released.

    And yes, Creo does seem to be awesome. ;-)

    Regards,

    Steve

  3. arminmon

    29 Jun 2016 User since 2016

    Thanks a lot. Got the whole idea from that video.
    Another question came to my mind. How can I process a JSON entry before showing it?
    Some cases I need to learn:

    1. Converting timestamps in the table.
    2. Shortening a long paragraph for preview based on character count. (to redirect for a complete view);

or Sign Up to reply!