Package rosetta :: Package basic :: Module _basic_ :: Class JsonEmitter
[hide private]
[frames] | no frames]

Class JsonEmitter

 object --+        
          |        
??.instance --+    
              |    
        Emitter --+
                  |
                 JsonEmitter

///////////////////////////////////////////////////////////////////////////
Lightweight class to ease writting JSON documents, a subset of YAML (http://json.org)
Using this class is not recommended -- use YamlEmitter instead.

 JSON is JavaScript Object Notation, the format for
 object and array literals in the JavaScript language.
 It also looks a great deal like nested Python dicts and lists,
 except for the special JSON values true, false, and null.
 (Python uses True, False, and None instead.
 Otherwise, JSON can be embedded directly into Python scripts.)

 JSON is legal subset of YAML, but leaves out much of YAML's complexity and advanced features.
 At the present time, there appears to be more library support
 for JSON than for YAML, especially for reading and parsing.
 (Both are fairly easy to write, as demonstrated here.)

 The topmost level of every valid JSON document consists of exactly one map,
 which is automatically started for you when the class is initialized.
 When you're finished you should call end(), and then probably flush().

 Whitespace is JSON documents is not significant.  By default, this class
 will try to pretty-print, showing the depth of nesting through indentation.
 When starting a new list or map, you can request that it not be indented
 (i.e., be printed all on one line), but all lists and maps nested inside it
 will also be printed without linebreaks, regardless of the requested indentation.

Instance Methods [hide private]
 
__init__(...)
__init__( (object)arg1, (OStream)out) -> None : basic/Emitter.hh:356
 
start_doc(...)
start_doc( (JsonEmitter)arg1) -> None : JSON doesn't support multiple documents, so this just calls end(1) to return you to the top (least-nested) level.

Inherited from Emitter: __reduce__, depth, end, end_list, end_map, flush, set_indent, start_list, start_map

Inherited from unreachable.instance: __new__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __instance_size__ = 32
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(...)
(Constructor)

 

__init__( (object)arg1, (OStream)out) -> None :
    basic/Emitter.hh:356

    C++ signature :
        void __init__(_object*,std::ostream {lvalue})

Overrides: object.__init__

start_doc(...)

 

start_doc( (JsonEmitter)arg1) -> None :
    JSON doesn't support multiple documents, so this just calls end(1)
    to return you to the top (least-nested) level.
    

    C++ signature :
        void start_doc(basic::JsonEmitter {lvalue})

Overrides: Emitter.start_doc