Add implementation for get_next_state_for_string()

This is a rip from #230, adding some utils for the JSON
deserializer implementation.