code: func (i *interpreter) manifestJSON(trace TraceElement, v value) (interface{}, error) {
  	switch v := v.(type) {
  
  	case *valueBoolean:
  		return v.value, nil
  
  	case *valueFunction:
  		return nil, makeRuntimeError("couldn't manifest function in JSON output.", i.getCurrentStackTrace(trace))
  
  	case *valueNumber:
  		return v.value, nil
  
  	case *valueString:
  		return v.getString(), nil
  
  	case *valueNull:
  		return nil, nil
  
  	case *valueArray:
  		result := make([]interface{}, 0, len(v.elements))
  		for _, th := range v.elements {
  			elVal, err := i.evaluatePV(th, trace)
  			if err != nil {
  				return nil, err
  			}
  			elem, err := i.manifestJSON(trace, elVal)
  			if err != nil {
  				return nil, err
  			}
  			result = append(result, elem)
  		}
  		return result, nil
  
  	case valueObject:
  		fieldNames := objectFields(v, withoutHidden)
  		sort.Strings(fieldNames)
  
  		err := checkAssertions(i, trace, v)
  		if err != nil {
  			return nil, err
  		}
  
  		result := make(map[string]interface{})
  
  		for _, fieldName := range fieldNames {
  			fieldVal, err := v.index(i, trace, fieldName)
  			if err != nil {
  				return nil, err
  			}
  
  			field, err := i.manifestJSON(trace, fieldVal)
  			if err != nil {
  				return nil, err
  			}
  			result[fieldName] = field
  		}
  
  		return result, nil
  
  	default:
  		return nil, makeRuntimeError(
  			fmt.Sprintf("manifesting this value not implemented yet: %s", reflect.TypeOf(v)),
  			i.getCurrentStackTrace(trace),
  		)
  
  	}
  }
docs: // manifestJSON converts to standard JSON representation as in "encoding/json" package