Quantum
Quantum13mo ago

Is there a built-in parser for the string that Deno.inspect produces?

I found out in another thread that Deno.inspect(myObj) produces a visually gorgeous string representation of objects and can represent internal data structures that JSON.stringify fails to represent. (Thank you @cknight for helping me with that!) My next question is, does Deno happen to have the analog of JSON.parse for what gets output by Deno.inspect? Can we take the Deno.inspect output and turn it back into what would become a clone of the original object? (To be clear: I am not asking if JSON.parse will do this. I am asking if there is a nifty Deno function that does it.)
3 Replies
herkulessi
herkulessi13mo ago
Should be impossible since inspect might be beautiful, however it's not complete. Especially it only goed like 3 steps deep into objects, shortens sstring and so forth
cknight
cknight13mo ago
Agreed, as nice as the output is, Deno.inspect() is a one way transformation.
Quantum
QuantumOP13mo ago
Ah well, very inspiring though. I think I might create my own serializer/deserializer based on these ideas. Thanks so much for the insights!