Object serialization: Difference between revisions
Content added Content deleted
(→{{header|TXR}}: New entry.) |
(→Insitux: inclusion) |
||
Line 1,148: | Line 1,148: | ||
let employees = Binary.decode bytes |
let employees = Binary.decode bytes |
||
print (employees :: [Employee])</syntaxhighlight> |
print (employees :: [Employee])</syntaxhighlight> |
||
=={{Header|Insitux}}== |
|||
Insitux does not have OOP-style objects, nor a recommended way to serialise into binary. The recommended serialisation/deserialisation method ([https://www.rosettacode.org/wiki/JSON#Insitux as JSON is not fully capable]) is <code>str</code> to serialise into a string, and <code>safe-eval</code> to deserialise from string. If <code>eval</code> was used it would be vulnerable to arbitrary code execution. |
|||
<syntaxhighlight lang="insitux"> |
|||
(var object {:a 1 :b "Hello, world!" [1 2 3] :c} |
|||
serialised (str object) |
|||
deserialised (safe-eval serialised)) |
|||
(print "Object: " object) |
|||
(print "Serialised: " serialised) |
|||
(str "Deserialised: " deserialised) |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
Object: {:a 1, :b "Hello, world!", [1 2 3] :c} |
|||
Serialised: {:a 1, :b "Hello, world!", [1 2 3] :c} |
|||
Deserialised: {:a 1, :b "Hello, world!", [1 2 3] :c} |
|||
</pre> |
|||
=={{header|J}}== |
=={{header|J}}== |