Moved JSON serialisation functions to upper namespace.