yajl.yajl_gen¶
Code that allows use of api/yajl_gen.h
-
exception
yajl.yajl_gen.YajlGenException(value='')¶ Bases:
yajl.yajl_common.YajlError
-
class
yajl.yajl_gen.YajlGen(**kwargs)¶ Bases:
objectYajl Generator - json formatting using yajl_gen
Parameters: - beautify (bool) – To pretty print json (or not)
- indent (string) – only valid when beautify=True
-
g¶ instance of :ctype:`yajl_gen` returned by :cfunc:`yajl.yajl_gen_alloc`. This should not be used directly.
-
_assert_retval(retval)¶ Parameters: retval (int) – yajl_gen_status return code Raises: YajlGenException – When retval is != yajl_gen_status_ok
-
_dispatch(name, *args)¶ Parameters: - name (string) – yajl func
nameto dispatch to - args (list or tuple) – arguments to pass to the dispatchee
Asserts that the returned value is proper or raises the proper
YajlGenException- name (string) – yajl func
-
_yajl_gen(name, *args)¶ Call the underlying yajl_gen c function/method
self.gmust be already allocated
-
yajl_gen_array_close()¶ indicate json array close
-
yajl_gen_array_open()¶ indicate json array begin
-
yajl_gen_bool(b)¶ Parameters: b (bool) – flag to be jsonified
-
yajl_gen_double(n)¶ Parameters: n (float) – number to be jsonified
-
yajl_gen_get_buf()¶ Returns: Formatted JSON Return type: string This function may be called in a streaming fashion, i.e. you can call this method many times, it will retrieve what was generated since the last call.
-
yajl_gen_integer(n)¶ Parameters: n (int) – number to be jsonified
-
yajl_gen_map_close()¶ indicate json map close
-
yajl_gen_map_open()¶ indicate json map begin
-
yajl_gen_null()¶ Generate json value
null
-
yajl_gen_number(s)¶ Parameters: s (string) – number to be jsonified Note to print floats or ints use
yajl_gen_double()oryajl_gen_integer()respectively.
-
yajl_gen_reset(sep='')¶
-
yajl_gen_string(s)¶ Parameters: s (string) – string to be jsonified