Stream Interview Question

State machine based on JSON input and expected output