trying to get segments serialized into json to send to the browser