res_stasis_device_state.c: Optimize stasis_app_device_states_to_json()