Support » Plugin: JSON Content Importer » Display Struct Keys

  • Resolved sashman13

    (@sashman13)


    Is there any way when looping over a structure to display the key? IE.

    “section”: {
    TAPROOM“: [{…}],
    PATIO“: [{…}],

    TAPROOM, PATIO

    This is fairly common in other json templating languages such as mustache. With that said, is there any plans to perhaps use a templating language such as jade/mustache/handlebars/etc? Perhaps as an add on to pro?

    Finally, the one issue we’ve had with the plugin is when a json feed errors out and you are caching. It would be nice if the json feed was checked for validity before invalidating the cache. We actually had to set up our own external caching to compensate for a spotty json api call.

    Appreciate the work and support on this plugin though. We use it on several sites.

    • This topic was modified 4 months, 3 weeks ago by sashman13.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author berkux

    (@berkux)

    Hi sashman13,

    the pro plugin uses twig as template engine. With that you can display keys.
    The free plugin has a limited template engine, which is unable to display keys.

    << It would be nice if the json feed was checked for validity before invalidating the cache.>>
    Should it be like this: A valid json is cached and when the caching-time runs out the API is connected. If the answer of the API is invalid the previous used cached JSON should be used?
    What criteria should be used to identify a valid from a invalid JSON?
    The http-code (200) or the existance of a JSON-field?

    Bernhard

    Appreciate it. We’ll be getting that.

    Yeah, in reverse proxy caching such as Varnish and I believe Nginx has it as well it’s called a grace/keep period. Basically, if the cache has expired and it would normally be replaced, instead it is kept while a new version is fetched. If the new version is not a 200 (or whatever your rule is), then it will continue to use the cached version. Grace is usually settable, so you can have like a cache of 1 hour and then a grace of 4 hours. After 4 hours it just dies if the origin is throwing non-200s.

    https://varnish-cache.org/docs/trunk/users-guide/vcl-grace.html

    • This reply was modified 4 months, 3 weeks ago by sashman13.
    • This reply was modified 4 months, 3 weeks ago by sashman13.
    Plugin Author berkux

    (@berkux)

    Ok, I see. I’ll check what can be improved here.
    This will take some time…

    Plugin Author berkux

    (@berkux)

    Check the new version 1.3.7.: In the options of the plugin you can set, how a non 200-error or a non-JSON can be handled by a using the maybe there cached JSON.

    • This reply was modified 4 months, 3 weeks ago by berkux.

    Damn, nice berkux. Guess we all have a little extra programming time nowadays. Stay healthy and safe.

    Plugin Author berkux

    (@berkux)

    😉
    Stay healthy and safe.

    Check, if this meets your ideas, please…

    • This reply was modified 4 months, 3 weeks ago by berkux.
Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.