refactor variable json deserialization