Dumps a serializable object to JSON. This API maps to the Python built-in
    json dumps method, with a few differences:

    * The return value is always valid JSON according to RFC 7159.
    * The input can be any of the following types:
        - SFrame
        - SArray
        - SGraph
        - single flexible_type (Image, int, long, float, datetime.datetime)
        - recursive flexible_type (list, dict, array.array)
        - recursive variant_type (list or dict of all of the above)
    * Serialized result includes both data and schema. Deserialization requires
      valid schema information to disambiguate various other wrapped types
      (like Image) from dict.

def dumps(obj):
    """
    Dumps a serializable object to JSON. This API maps to the Python built-in
    json dumps method, with a few differences:

    * The return value is always valid JSON according to RFC 7159.
    * The input can be any of the following types:
        - SFrame
        - SArray
        - SGraph
        - single flexible_type (Image, int, long, float, datetime.datetime)
        - recursive flexible_type (list, dict, array.array)
        - recursive variant_type (list or dict of all of the above)
    * Serialized result includes both data and schema. Deserialization requires
      valid schema information to disambiguate various other wrapped types
      (like Image) from dict.
    """
    (data, schema) = to_serializable(obj)
    return _json.dumps({'data': data, 'schema': schema})