Wp.SpaJsonBuilder

Fields

None

Methods

class

new_array ()

class

new_object ()

add_boolean (value)

add_float (value)

add_from_string (json_str)

add_from_stringn (json_str, len)

add_int (value)

add_json (json)

add_null ()

add_property (key)

add_string (value)

end ()

ref ()

unref ()

Details

class Wp.SpaJsonBuilder

New in version 0.4.8.

classmethod new_array()
Returns:

the new spa json builder

Return type:

Wp.SpaJsonBuilder

Creates a spa json builder of type array.

classmethod new_object()
Returns:

the new spa json builder

Return type:

Wp.SpaJsonBuilder

Creates a spa json builder of type object.

add_boolean(value)
Parameters:

value (bool) – the boolean value

Adds a boolean value into the builder.

add_float(value)
Parameters:

value (float) – the float value

Adds a float value into the builder.

add_from_string(json_str)
Parameters:

json_str (str) – the json string

Adds a json string into the builder.

add_from_stringn(json_str, len)
Parameters:
  • json_str (str) – the json string

  • len (int) – the specific length of the json string

Adds a json string with specific length into the builder.

add_int(value)
Parameters:

value (int) – the int value

Adds a int value into the builder.

add_json(json)
Parameters:

json (Wp.SpaJson) – the json value

Adds a json value into the builder.

add_null()

Adds a null value into the builder.

add_property(key)
Parameters:

key (str) – the name of the property

Adds a property into the builder.

add_string(value)
Parameters:

value (str) – the string value

Adds a string value into the builder.

end()
Returns:

the constructed spa json object

Return type:

Wp.SpaJson

Ends the builder process and returns the constructed spa json object.

ref()
Returns:

self with an additional reference count on it

Return type:

Wp.SpaJsonBuilder

Increases the reference count of a spa json builder.

unref()

Decreases the reference count on self and frees it when the ref count reaches zero.