Does Go have serialization with plain text result like PHP function serialize()?
String s:size:value;
Integer i:value;
Boolean b:value; (does not store "true" or "false", does store '1' or '0')
Null N;
Array a:size:{key definition;value definition;(repeated per element)}
The closest of php.serialize would be the encoding package with methods like MarshalText()
/ UnmarshalText()
: any object implementing the interface TextMarshaler
/TextUnmarshaler
would be serializable.
(And you have the same feature for binary marshal/unmarshal)
You can see examples for JSON, but you can find other projects for other type of data:
ajg/form
: a Form Encoding & Decoding Package for GoWell, not exactly.
There's gob which is binary, or you can use json (same as php's json_encode / json_decode.
For cross-language (binary) solutions there're few options: