---
title: "DatapointDecoder.Unmarshal"
description: "Decode a raw protobuf datapoint into a JSON-like map with configurable protobuf decoding options."
image: "https://tilebox.com/images/tilebox-docs-social-preview.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://tilebox.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# DatapointDecoder.Unmarshal

import { Fragment } from "astro/jsx-runtime";

import ApiReference from "@docs/components/ApiReference.astro";

import ParamField from "@docs/components/ParamField.astro";

```go
func (d datasets.DatapointDecoder) Unmarshal(
    descriptor *datasets.DatapointDescriptor,
    data []byte,
) (map[string]any, error)
```

Decode a raw protobuf datapoint into a JSON-like map with configurable protobuf decoding options.

## Parameters

**descriptor**

type: *datasets.DatapointDescriptor

required: true

The descriptor returned by [`NewDatapointDescriptor`](/docs/api-reference/go/datasets/NewDatapointDescriptor).
**data**

type: []byte

required: true

The raw protobuf datapoint bytes returned by a datapoint query.

## Decoder options

**AllowPartial**

type: bool

Allow messages that are missing required fields.
**DiscardUnknown**

type: bool

Ignore unknown fields in the raw protobuf message.
**Resolver**

Override the resolver used to look up message and extension types.
**RecursionLimit**

type: int

Limit how deeply nested messages may be decoded. A zero value uses the protobuf default.

## Returns

A map of datapoint fields, or an error if the raw datapoint cannot be decoded.

<h2 id="request-example">Usage example</h2>

```go
decoder := datasets.DatapointDecoder{
    DiscardUnknown: true,
}

datapoint, err := decoder.Unmarshal(descriptor, data)
if err != nil {
    return err
}
```

Source: https://tilebox.com/docs/api-reference/go/datasets/DatapointDecoder.Unmarshal/index.mdx
