Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples for unsigned integers and nils #5

Open
uKL opened this issue Jun 14, 2018 · 1 comment
Open

Examples for unsigned integers and nils #5

uKL opened this issue Jun 14, 2018 · 1 comment

Comments

@uKL
Copy link

uKL commented Jun 14, 2018

Hey,

I have some issues implementing my expected behavior.

1. Unsigned integers

I'd like to pack a number as uint8. How can I do that? Using byte as a type doesn't seem to work.

2. Integer based keys

The example shows packing an object into MsgPack. I'd like to pack my own structure which looks like

{
   someUInt8Key: someUInt8Value
}

or

{
   someUInt8Key: [someUInt8Value, someOtherUInt8Value]
}

Can I achieve it with MoshiPack?

3. Packing nulls

Following the example, I modified it to have

data class MessagePackWebsitePlug(var compact: Byte? = null)

which packs to bytes [0x80] which means that it's a map with length 0. Is there any way to pack nulls?

Let me know your thoughts :)

@timmc
Copy link

timmc commented Apr 26, 2021

On nulls, I think you'll need to pass in a Moshi instance configured to serialize nulls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants