import pickle
import base64
import json


def im2json(im):
    """Convert a Numpy array to JSON string"""
    imdata = pickle.dumps(im)
    print(len(base64.b64encode(imdata).decode('ascii')))
    jstr = json.dumps({"body": base64.b64encode(imdata).decode('ascii')})

    return jstr