Question: I wonder if anyone could help me extend [the smoothing example in the SciPy cookbook](http://wiki.scipy.org/Cookbook/SignalSmooth) to a 2D problem.

This script works great for smoothing a 1D function, and they also give code for a 2D smoothing in both axis (i.e. blurring an image).

However, I'd like to apply this function to a 2D dataset, but only along one axis (x direction). I could do this in a loop, by inspecting each slice in y, applying the 1D convolution, then rebuilding the array. But this seems poor coding technique.

Therefore, I wonder how to do it in 2D? I imagine I need to make a 2D kernel with weights changing along one direction only, but I'm not sure how to do this, or which convolve function to use (`numpy.convolve`, `scipy.signal.convolve`, `scipy.ndimage.filters.convolve1d` etc.)

Answer: 
The problem is that you cannot put `NSData` in JSON. The `audio` is `NSData`. As the `NSJSONSerialization` [documentation](https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSJSONSerialization_Class/index.html) says:

> 
> An object that may be converted to JSON must have the following properties:
> 
> 
> * The top level object is an `NSArray` or `NSDictionary`.
> * All objects are instances of `NSString`, `NSNumber`, `NSArray`, `NSDictionary`, or `NSNull`.
> * All dictionary keys are instances of `NSString`.
> * Numbers are not `NaN` or infinity.
> 
> 
> 

If you want to include `NSData` in JSON, you have to convert it to a string. The common way to do that is to base64 encode it (and then, in the destination, decode the base64 string).
You have a syntax error in your Json text. check it on <http://www.jsoneditoronline.org> and try again when you are sure if it is correct formed Json