serializer.*xmlSerializer.Serialize   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 5
nop 2
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
package serializer
2
3
import "github.com/clbanning/mxj"
4
5
type xmlSerializer struct {
6
	rootTag string
7
}
8
9
func (serializer *xmlSerializer) Serialize(data interface{}, format string) ([]byte, error) {
10 1
	if object, isObject := data.(map[string]interface{}); isObject {
11 1
		xml := mxj.Map(object)
12 1
		return xml.Xml()
13
	}
14
15 1
	return mxj.AnyXml(data, serializer.rootTag)
16
}
17