A first functional version of obiclean

This commit is contained in:
2022-08-20 18:01:07 +02:00
parent a07d348aea
commit 5dd835d3e7
16 changed files with 1091 additions and 8 deletions

View File

@@ -210,17 +210,22 @@ func ParseOBIFeatures(text string, annotations obiseq.Annotation) string {
bvalue = bytes.TrimSpace(part[m[0]:(m[1] - 1)])
j := bytes.ReplaceAll(bvalue, []byte("'"), []byte(`"`))
var err error
if strings.HasPrefix(key, "merged_") ||
strings.HasSuffix(key, "_count") {
switch {
case strings.HasPrefix(key, "merged_") ||
strings.HasSuffix(key, "_count"):
dict := make(map[string]int)
err = json.Unmarshal(j, &dict)
value = dict
} else {
case strings.HasSuffix(key, "_status"):
dict := make(map[string]string)
err = json.Unmarshal(j, &dict)
value = dict
default:
dict := make(map[string]interface{})
err = json.Unmarshal(j, &dict)
value = dict
}
if err != nil {
value = string(bvalue)
}