[Roland] > yes, there is: subclass+extend the JSON-encoder, see pydoc json. Please read the original post before answering. What you suggested does not work since NaN is of float type.