How to convert ArcGIS Server JSON to GeoJSON?
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
And I've started implementing the same thing in python, but in both directions. https://github.com/odoe/SpatialJSON