* Karam Qubsi (karamqubsi@gmail.com) wrote:
Hi ,
Hi Karam
First I'm very new with JSON . I'd like to ask : as I understood from JSON documentation that the output data in JSON format must look like something like to this : [ { "Name" : "Alfreds Futterkiste", "City" : "Berlin", "Country" : "Germany" }, { "Name" : "Berglunds snabbköp", "City" : "Luleå", "Country" : "Sweden" }, { "Name" : "Centro comercial Moctezuma", "City" : "México D.F.", "Country" : "Mexico" }, { "Name" : "Ernst Handel", "City" : "Graz", "Country" : "Austria" } ]
but in Koha the output for Public reports is like this :
[["23-12-2014","maisara","6"],["23-12-2014","nadia","10"],["22-12-2014","hakkar","17"],["22-12-2014","nadia","3"],["22-12-2014","abdramaneg","21"]]
the field names is not in the output , and I realized ( & maybe I'm wrong) that to handle JSON text you must have id for each field ) to handle it with your script .
That isn't true, what is above is an array of arrays, represented in JSON, you can hndle that just fine in whatever you have that is consuming the JSON
so is this a correct output from Koha ? and can be handled in some advanced methods with JSON ?
or do I have to write my SQL report in a way to CONCAT the field name with the field data in every data cell ?
If you want the data instead as an array of hashes (in perl speak) like your first example of JSON is describing all you need to do is add &annotated=1 To the url, (at least in 3.16.0 or older) Chris
thanks :) .
--
*Karam Qubsi <https://www.linkedin.com/in/kqubsi>*
*Shah Alam , Malaysia . * _______________________________________________ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz http://lists.katipo.co.nz/mailman/listinfo/koha
-- Chris Cormack Catalyst IT Ltd. +64 4 803 2238 PO Box 11-053, Manners St, Wellington 6142, New Zealand