Encoding json to interface