// DecodeToDocument decodes the given string using the given media type and returns the decoded document.
DecodeToDocument decodes the given string using the given media type and returns the decoded document.
// DecodeToDocument decodes the given string using the given media type and returns the decoded document .
func DecodeToDocument(content string, mediaType MediaType) (Document, error) {
	docBytes, err := Decode(content, mediaType)
	if err != nil {
		return nil, err
	}
	doc := make(Document)
	err = json.Unmarshal(docBytes, &doc)
	if err != nil {
		return nil, fmt.Errorf("unmarshal json: %w", err)
	}
	return doc, nil
}
func DecodeToDocument ( content string , mediaType MediaType ) ( Document , error ) { docBytes , err := Decode ( content , mediaType ) if err != nil { return nil , err } doc := make ( Document ) err = json . Unmarshal ( docBytes , & doc ) if err != nil { return nil , fmt . Errorf ( " " , err ) } return doc , nil }
DecodeToDocument decodes the given string using the given media type and returns the decoded document.
DecodeToDocument decodes the given string using the given media type and returns the decoded document .