https://github.com/msgpack/msgpack-smalltalk
MessagePack serialization library for various Smalltalk dialects / msgpack.org[Smalltalk]
https://github.com/msgpack/msgpack-smalltalk
cuis msgpack pharo serialization smalltalk squeak
Last synced: 3 months ago
JSON representation
MessagePack serialization library for various Smalltalk dialects / msgpack.org[Smalltalk]
- Host: GitHub
- URL: https://github.com/msgpack/msgpack-smalltalk
- Owner: msgpack
- Created: 2012-07-18T06:39:10.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2025-05-19T12:42:32.000Z (7 months ago)
- Last Synced: 2025-05-27T08:53:23.163Z (7 months ago)
- Topics: cuis, msgpack, pharo, serialization, smalltalk, squeak
- Language: Smalltalk
- Homepage: http://msgpack.org/
- Size: 206 KB
- Stars: 22
- Watchers: 8
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-pharo - msgpack-smalltalk - MessagePack serialization library. (Data interexchange format)
README
msgpack-smalltalk
=================
[](https://github.com/msgpack/msgpack-smalltalk/actions/workflows/main.yml)
MessagePack serialization library for various Smalltalk dialects.
- Squeak
- Pharo
- VisualWorks
- VA Smalltalk
- Dolphin Smalltalk
- GNU Smalltalk (Beta)
- [Cuis](https://github.com/mumez/Cuis-Smalltalk-MessagePack)
Sources are put as [Cypress](https://github.com/CampSmalltalk/Cypress/blob/master/README.md) for the neutral accesses from various Smalltalk dialects.
## How to use ##
### Serialization ###
```Smalltalk
MpMessagePack pack:
```
or:
```Smalltalk
messagePacked
```
### Deserialization ###
```Smalltalk
MpMessagePack unpack: msgpackBytes
```
or:
```Smalltalk
Object fromMessagePack: msgBytes
```
### Samples ###
```Smalltalk
map := Dictionary new.
map at: 'someArray' asByteArray put: #(1 2.2 #[3 4 5]).
packed := map messagePacked.
(Object fromMessagePack: packed) inspect.
```
```Smalltalk
writeStream := WriteStream on: ByteArray new.
encoder := MpEncoder on: writeStream.
encoder nextPut: 1.
encoder nextPut: #(2 3).
dic := Dictionary new.
dic at: 4 put: 5.
encoder nextPut: dic.
encoder nextPut: 'four' asByteArray.
bytes := encoder contents.
readStream := ReadStream on: bytes.
decoder := MpDecoder on: readStream.
[decoder atEnd] whileFalse: [
Transcript cr; show: decoder next printString
]
```
### How to install
Please read [HowToInstall.md]().
### Loading the latest development version
#### Squeak 4
```Smalltalk
Installer squeaksource
project: 'MessagePack';
install: 'ConfigurationOfMessagePack'.
(Smalltalk at: #ConfigurationOfMessagePack) project development load
```
#### Pharo & Squeak 5+
```Smalltalk
Metacello new
baseline: 'MessagePack';
repository: 'github://msgpack/msgpack-smalltalk:develop/repository';
load.
```
You might need ```MpTypeMapper initializeAll ``` on new encoder/decoder-related updates.
#### Limitation on Squeak 5+
Starting with Squeak 5 and 6, DateAndTime only supports microsecond precision. Because of this, nanosecond values are not properly decoded as DateAndTime.
Two unit tests (testPackUnpackTimestamp64, 96) fail on Squeak 5 and 6.