9 //DebugPrint Print a JSONNode as json withindent
10 func (that *JSONNode) DebugPrint(prefix string) {
11 asJSON, err := json.MarshalIndent(that, "", " ")
13 fmt.Printf("%s\n", err.Error())
16 fmt.Printf("%s%s\n", prefix, asJSON)
19 func printfindent(indentlevel int, indentchar string, format string, args ...interface{}) {
20 for i := 0; i < indentlevel; i++ {
21 fmt.Printf("%s", indentchar)
23 fmt.Printf(format, args...)
26 func (that *JSONNode) debugProspectValue(indentlevel int, indentchar string) {
27 printfindent(indentlevel, indentchar, "Is of Type: TypeValue\n")
28 printfindent(indentlevel, indentchar, "Value of type: %T\n", that.Get())
29 printfindent(indentlevel, indentchar, "%+v\n", that.Get())
32 func (that *JSONNode) debugProspectMap(indentlevel int, indentchar string) {
33 printfindent(indentlevel, indentchar, "Is of Type: TypeMap\n")
34 for key := range that.m {
35 printfindent(indentlevel, indentchar, "%s:\n", key)
36 that.m[key].DebugProspect(indentlevel+1, indentchar)
40 func (that *JSONNode) debugProspectArray(indentlevel int, indentchar string) {
41 printfindent(indentlevel, indentchar, "Is of Type: TypeArray\n")
42 for key := range that.a {
43 printfindent(indentlevel, indentchar, "[%d]:\n", key)
44 that.a[key].DebugProspect(indentlevel+1, indentchar)
48 //DebugProspect Print all the data the we ve got on a node and all it s children
49 func (that *JSONNode) DebugProspect(indentlevel int, indentchar string) {
52 that.debugProspectValue(indentlevel, indentchar)
54 that.debugProspectMap(indentlevel, indentchar)
56 that.debugProspectArray(indentlevel, indentchar)
58 printfindent(indentlevel, indentchar, "Is of Type: TypeUndefined\n")