JSON IR for templating and corresponding runtime implementation