Don't retain results where the value is empty
Empty quad terms are not valid, so we should be able to safely drop any results where the value is "".
This commit is contained in:
parent
6308affc69
commit
e71d19c851
1 changed files with 11 additions and 6 deletions
|
|
@ -210,17 +210,22 @@ func (s *Session) BuildJSON(result interface{}) {
|
|||
if data.val == nil {
|
||||
obj := make(map[string]string)
|
||||
tags := data.actualResults
|
||||
tagKeys := make([]string, len(tags))
|
||||
i := 0
|
||||
var tagKeys []string
|
||||
for k := range tags {
|
||||
tagKeys[i] = k
|
||||
i++
|
||||
tagKeys = append(tagKeys, k)
|
||||
}
|
||||
sort.Strings(tagKeys)
|
||||
for _, k := range tagKeys {
|
||||
obj[k] = s.qs.NameOf(tags[k])
|
||||
name := s.qs.NameOf(tags[k])
|
||||
if name != "" {
|
||||
obj[k] = name
|
||||
} else {
|
||||
delete(obj, k)
|
||||
}
|
||||
}
|
||||
if len(obj) != 0 {
|
||||
s.dataOutput = append(s.dataOutput, obj)
|
||||
}
|
||||
s.dataOutput = append(s.dataOutput, obj)
|
||||
} else {
|
||||
if data.val.IsObject() {
|
||||
export, _ := data.val.Export()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue