JsonWriter
Inherits from: Object
Class Methods
primitives
class primNew
class primNewPretty
uncategorized
class new
Create a new compact JsonWriter.
Example
JsonWriter new contents "=> ''"
class newPretty
Create a new pretty-printing JsonWriter with two-space indent.
Example
| writer <JsonWriter> |
writer := JsonWriter newPretty.
writer write: #{'a' -> 1}.
writer contents
Instance Methods
primitives
primContents
primReset
primWrite:
uncategorized
contents
Return the accumulated JSON output as a string.
Example
| writer <JsonWriter> |
writer := JsonWriter new.
writer write: true.
writer contents "=> 'true'"
reset
Clear the output buffer.
Example
| writer <JsonWriter> |
writer := JsonWriter new.
writer write: 1.
writer reset.
writer contents "=> ''"
write:
Encode and append a value to the output buffer.
Example
| writer <JsonWriter> |
writer := JsonWriter new.
writer write: #(1 2 3).
writer contents "=> '[1,2,3]'"