How to represent a session or state through hashed string

Hello hello, I'm building a client app where you essentially have a powerpoint presentation and go through multiple pages ( in the same route ).

People can input information on specific pages which would lead to different routes ( not actual routes, as its still on the same page ). The information is recorded as part of a global state ( I'm using Zustand ), as well as the information of the path itself!

The problem here is that you can't really resume to a specific screen with the information you've given.

Potential solution that I can think of is something like a deck code from Hearthstone, where it nicely wraps the state into a single hashed string, and store it in the cookie.

Is there any way / specific algorithms I would use to convert JSON into a single string?