Fixed generated code for creating new instances where the wrong template was used in typed json.
Merge branch 'issue/1940' into develop