Are you in a PICKLE? Maybe this can help...

Published on 07 Aug 2020 by Steve Eynon

Are you in a PICKLE? Maybe this can help...

Pickle is a new library for Fantom programmers that converts your Fantom objects to and from strings. Now available to download from the Fantom pod repository @ eggbox.fantomfactory.org!

Pickles Fantom objects to and from strings

Pickle is an enhancement of the standard Fantom serialisation framework; Pickle fixes lots of outstanding bugs and adds many new useful features.

Quick start

// Given this class
class Gerkin {
    Str name := "Rick"
}

...

// ...convert it to a string
str := Pickle.writeObj(Gerkin())
  // "acme::Gerkin {
  //      name="Rick"
  //  }"


// ...and back again!
juicy := (Gerkin) Pickle.readObj(str)
juicy.name  // --> Rick

Enhancements

Pickle adds many new options to the standard read and write functions, sucn as:

  • define custom fuctions to build read Fantom objects (think IoC or BeanBuilder)
  • more indent options for pretty printing
  • remove bloat by skipping null values when serialising objects
  • compress object strings by defining using statements when serialising objects

We use Pickle internally at Fantom Factory to efficiently transport Fantom objects in a web server to / from a browser.

>> Read more about Pickle on Eggbox <<

< Back to all articles