json.generator
Module for [Generator] class
Types 3
json.generator.Generator provides an object for generating a JSON data stream from a tree of json.node.Node instances, and put it into a buffer or a file.
Methods
GeneratorGidBuilder builder() static nothrowGet builder for [json.generator.Generator] Returns: New builder objectuint indent() @property nothrowGet `indent` property. Returns: Number of spaces to be used to indent when pretty printing.void indent(uint propval) @property nothrowSet `indent` property. Params: propval = Number of spaces to be used to indent when pretty printing.uint indentChar() @property nothrowGet `indentChar` property. Returns: The character that should be used when indenting in pretty print.void indentChar(uint propval) @property nothrowSet `indentChar` property. Params: propval = The character that should be used when indenting in pretty print.bool pretty() @property nothrowGet `pretty` property. Returns: Whether the output should be "pretty-printed", with indentation and newlines.void pretty(bool propval) @property nothrowSet `pretty` property. Params: propval = Whether the output should be "pretty-printed", with indentation and newlines.json.node.Node root() @property nothrowGet `root` property. Returns: The root node to be used when constructing a JSON data stream.void root(json.node.Node propval) @property nothrowSet `root` property. Params: propval = The root node to be used when constructing a JSON data stream.uint getIndent() nothrowRetrieves the value set using [json.generator.Generator.setIndent]. Returns: the number of repetitions per indentation leveldchar getIndentChar() nothrowRetrieves the value set using [json.generator.Generator.setIndentChar]. Returns: the character to be used when indentingbool getPretty() nothrowRetrieves the value set using [json.generator.Generator.setPretty]. Returns: `TRUE` if the generated JSON should be pretty-printed, and `FALSE` otherwisejson.node.Node getRoot() nothrowRetrieves a pointer to the root node set using [json.generator.Generator.setRoot]. Returns: the root nodevoid setRoot(json.node.Node node) nothrowSets the root of the JSON data stream to be serialized by the given generator.string toData(out size_t length) nothrowGenerates a JSON data stream from generator and returns it as a buffer.bool toFile(string filename)Creates a JSON data stream and puts it inside `filename`, overwriting the file's current contents.glib.string_.String toGstring(glib.string_.String string_) nothrowGenerates a JSON data stream and appends it to the string buffer.bool toStream(gio.output_stream.OutputStream stream, gio.cancellable.Cancellable cancellable = null)Outputs JSON data and writes it (synchronously) to the given stream.Fluent builder implementation template for json.generator.Generator
Methods
T indent(uint propval) nothrowSet `indent` property. Params: propval = Number of spaces to be used to indent when pretty printing. Returns: Builder instance for fluent chainingT indentChar(uint propval) nothrowSet `indentChar` property. Params: propval = The character that should be used when indenting in pretty print. Returns: Builder instance for fluent chainingT pretty(bool propval) nothrowSet `pretty` property. Params: propval = Whether the output should be "pretty-printed", with indentation and newlines.T root(json.node.Node propval) nothrowSet `root` property. Params: propval = The root node to be used when constructing a JSON data stream. Returns: Builder instance for fluent chainingFluent builder for json.generator.Generator