Json.Decode.Value to string without Debug.toString?

I’m working on removing old 0.18 toString uses in my code for the 0.19 upgrade, and there are a few cases where I was using it for logging some debug info on Json.Decode.Values. Is there a general way to convert a Json.Decode.Value to a string representation without using Debug.toString (I’d rather not have to manually add that call in and take it out each time I start or stop debugging if possible) and without decoding it?

1 Like

I don’t think that is possible, but here’s nice idea from @jerith : Debug.log and --optimize

Move Debug.toString to separate helper module and then you only have one place to change when changing debugging on/off.

4 Likes

Json.Encode.encode should work?

6 Likes

Woah. It’s weird how you only think of things for their most common use case sometimes (e.g. sending things in requests/ports/etc) and completely forget that they work just as well in other cases. Thanks!

1 Like

No problem! I know exactly what you mean, I was stuck in this same problem some weeks ago.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.