O'Reilly logo

NativeScript for Angular Mobile Development by Nathanael J. Anderson, Nathan Walker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Serializing data for persistence and hydrating it back upon retrieval

This all works really nicely, however, we have introduced a problem. Our MixerService provides the ability to save these compositions with all their tracks. However the tracks now contain complex objects such as Observables and even private references with getters and setters. 

When persisting data, you will often want to use JSON.stringify to serialize objects when storing them so that they can be retrieved later and hydrated into more complex models if needed.

In fact, if you were to attempt to process our TrackModel with JSON.stringify now, it would fail because you cannot stringify certain structures. So, we now need a way to serialize our data before storing it, as ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required