Home Explore Blog CI



nushell

commands/docs/from_msgpack.md
a447e02b2911601338f536e1955c05325813ac27af06cffc0000000300000a1c
---
title: from msgpack
categories: |
  formats
version: 0.104.0
formats: |
  Convert MessagePack data into Nu values.
usage: |
  Convert MessagePack data into Nu values.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `from msgpack` for [formats](/commands/categories/formats.md)

<div class='command-title'>Convert MessagePack data into Nu values.</div>

## Signature

```> from msgpack {flags} ```

## Flags

 -  `--objects`: Read multiple objects from input


## Input/output types:

| input  | output |
| ------ | ------ |
| binary | any    |
## Examples

Read a list of values from MessagePack
```nu
> 0x[93A3666F6F2AC2] | from msgpack
╭───┬───────╮
│ 0 │ foo   │
│ 1 │    42 │
│ 2 │ false │
╰───┴───────╯

```

Read a stream of multiple values from MessagePack
```nu
> 0x[81A76E757368656C6CA5726F636B73A9736572696F75736C79] | from msgpack --objects
╭───┬─────────────────────╮
│ 0 │ ╭─────────┬───────╮ │
│   │ │ nushell │ rocks │ │
│   │ ╰─────────┴───────╯ │
│ 1 │ seriously           │
╰───┴─────────────────────╯

```

Read a table from MessagePack
```nu
> 0x[9282AA6576656E745F6E616D65B141706F6C6C6F203131204C616E64696E67A474696D65C70CFF00000000FFFFFFFFFF2CAB5B82AA6576656E745F6E616D65B44E757368656C6C20666972737420636F6D6D6974A474696D65D6FF5CD5ADE0] | from msgpack
╭───┬──────────────────────┬──────────────╮
│ # │      event_name      │     time     │
├───┼──────────────────────┼──────────────┤
│ 0 │ Apollo 11 Landing    │ 55 years ago │
│ 1 │ Nushell first commit │ 5 years ago  │
╰───┴──────────────────────┴──────────────╯

```

## Notes

Not all values are representable as MessagePack.

The datetime extension type is read as dates. MessagePack binary values are
read to their Nu equivalent. Most other types are read in an analogous way to
`from json`, and may not convert to the exact same type if `to msgpack` was
used originally to create the data.

MessagePack: https://msgpack.org/

Chunks
3c20b548 (1st chunk of `commands/docs/from_msgpack.md`)
Title: from msgpack
Summary
Converts MessagePack data into Nu values. It supports flags to read multiple objects from the input. The command takes binary input and produces any type of Nu value as output. Several examples are provided, including reading a list of values, a stream of multiple values, and a table. It is noted that not all values are representable as MessagePack, datetime extension type is read as dates, and binary values are read to their Nu equivalent. It provides a link to MessagePack documentation.