Files
Christian Nennemann bbf557e54b Restructure refimpl into go-lang and python subdirectories
Move Go reference implementation to refimpl/go-lang/ and add new
Python reference implementation in refimpl/python/. Update build.sh
with renamed draft and simplified tool paths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 23:11:55 +01:00

35 lines
617 B
Go

package ect
import "encoding/json"
func marshalJSONString(s string) []byte {
b, _ := json.Marshal(s)
return b
}
func marshalJSONStringArray(a []string) []byte {
b, _ := json.Marshal(a)
return b
}
func unmarshalAudience(data []byte, a *Audience) error {
var raw json.RawMessage
if err := json.Unmarshal(data, &raw); err != nil {
return err
}
if len(raw) > 0 && raw[0] == '[' {
var arr []string
if err := json.Unmarshal(raw, &arr); err != nil {
return err
}
*a = arr
return nil
}
var s string
if err := json.Unmarshal(raw, &s); err != nil {
return err
}
*a = []string{s}
return nil
}