blob: 8567f3a996f13ba102f3a7342b2b4a668b27a3e3 [file] [log] [blame]
package jsondiff
import "fmt"
type Type string
const (
Number Type = "number"
Object Type = "object"
Array Type = "array"
Bool Type = "bool"
String Type = "string"
Null Type = "null"
)
func GetType(json interface{}) Type {
switch json.(type) {
case []interface{}:
return Array
case float64:
return Number
case string:
return String
case bool:
return Bool
case nil:
return Null
case map[string]interface{}:
return Object
default:
panic(fmt.Sprintf("unrecognized json type %T", json))
}
}