code: func PathElementString(pe fieldpath.PathElement) (string, error) {
  	switch {
  	case pe.FieldName != nil:
  		return Field + Separator + *pe.FieldName, nil
  	case len(pe.Key) > 0:
  		kv := map[string]json.RawMessage{}
  		for _, k := range pe.Key {
  			b, err := k.Value.ToJSON()
  			if err != nil {
  				return "", err
  			}
  			m := json.RawMessage{}
  			err = json.Unmarshal(b, &m)
  			if err != nil {
  				return "", err
  			}
  			kv[k.Name] = m
  		}
  		b, err := json.Marshal(kv)
  		if err != nil {
  			return "", err
  		}
  		return Key + ":" + string(b), nil
  	case pe.Value != nil:
  		b, err := pe.Value.ToJSON()
  		if err != nil {
  			return "", err
  		}
  		return Value + ":" + string(b), nil
  	case pe.Index != nil:
  		return Index + ":" + strconv.Itoa(*pe.Index), nil
  	default:
  		return "", errors.New("Invalid type of path element")
  	}
  }
docs: // PathElementString serializes a path element