I´m writing an application that relies on Ajax requests to retrieve data from a dataBase, the required info is delivered in a Json set of objects, this means that even for the empty fields of the dataBase a pair of propriety/value is generated:
[{"field1":"value1","field2":"value2","field3":""},{"field1":"","field2":"","field3":""}]
How can I Select only not empty fields from the dataBase via SQL avoiding generating and sending unnecessary data?
If your data in the table is NULL then you can selected records as appropriate using something like
However – if you want to omit the definitions from the JSON for partially empty records, such that
was transmitted as
Then that is something you would need to do by customising whatever JSON Serializer you are using.