func ObjectFromMap(key string, data map[string]interface{}) (*pb.Object, error) {
	items := make(map[string]*pb.Field, len(data))
	for k, v := range data {
		field, err := buildField(k, v)
		if err != nil {
			return nil, err
		}
		items[k] = field
	}
	return &pb.Object{
		Items: items,
	}, nil
}
ObjectFromMap creates an Object, using the entries of a map as fields.
This supports maps embedded as values. It is assumed that types are limited to JSON types.
package data
import (
	"encoding/json"
	"errors"
	"fmt"
	pb "rsprd.com/spread/pkg/spreadproto"
)
func CreateObject(key string, ptr interface{}) (*pb.Object, error) {
	data, err := json.Marshal(ptr)
	if err != nil {
		return nil, fmt.Errorf("unable to generate JSON object: %v", err)
	}
	var jsonData map[string]interface{}
	err = json.Unmarshal(data, &jsonData)
	if err != nil {
		return nil, err
	}
	return ObjectFromMap(key, jsonData)
}