in reply to Re: Mojolicios - render json with field names
in thread Mojolicios - render json with field names

I'm trying to use http://easyautocomplete.com/guide and need to send it JSON data like in the example. My SQL query works ok, I just don't get how to change this into a JSON return like needed in the sample data of the jQuery plugin.
  • Comment on Re^2: Mojolicios - render json with field names

Replies are listed 'Best First'.
Re^3: Mojolicios - render json with field names
by Corion (Patriarch) on Nov 10, 2016 at 14:57 UTC

    I highly doubt that you need to send the JSON in the format you described because that format is not valid JSON.

    I suggest you reconsider my approach and let DBI process the data into a format that can be directly handed to any kind of JSON processor and will produce the appropriate JSON output.

    Update:

    Note that your proposed format does not use double quotes for the entries product and price, and that your proposed format uses square brackets []. The documentation at http://easyautocomplete.com/guide does always use quoted entries and uses objects within {}.

      my fault, your example works well, i didn't copy it right