fixed exception in AsJson
found a way to remove redundant definition of generic types for pin creation