concrete.util.json_fu module

Convert Concrete objects to JSON strings

concrete.util.json_fu.communication_file_to_json(communication_filename, remove_timestamps=False, remove_uuids=False)

Get a “pretty-printed” JSON string representation for a Communication

Parameters:
  • communication_filename (str) – Communication filename
  • remove_timestamps (bool) – Flag for removing timestamps from JSON output
  • remove_uuids (bool) – Flag for removing UUID info from JSON output
Returns:

A “pretty-printed” JSON representation of the Communication

Return type:

str

concrete.util.json_fu.get_json_object_without_timestamps(json_object)

Create a copy of a JSON object created by json.loads(), with all representations of AnnotationMetadata timestamps (dictionary keys with value timestamp) recursively removed.

Parameters:json_object – Python object created from string by json.loads()
Returns:A copy of the input data structure with all timestamp objects removed
concrete.util.json_fu.get_json_object_without_uuids(json_object)

Create a copy of a JSON object created by json.loads(), with all representations of UUID objects (dictionaries containing a ‘uuidString’ key) recursively removed.

Parameters:json_object – Python object created from string by json.loads()
Returns:A copy of the input data structure with all UUID objects removed
concrete.util.json_fu.thrift_to_json(tobj, remove_timestamps=False, remove_uuids=False)

Get a “pretty-printed” JSON string representation for a Thrift object

Parameters:
  • tobj – A Thrift object
  • remove_timestamps (bool) – Flag for removing timestamps from JSON output
  • remove_uuids (bool) – Flag for removing UUID info from JSON output
Returns:

A “pretty-printed” JSON representation of the Thrift object

Return type:

str

concrete.util.json_fu.tokenlattice_file_to_json(toklat_filename)

Get a “pretty-printed” JSON string representation for a TokenLattice

Parameters:toklat_filename (str) – String specifying TokenLattice filename
Returns:A “pretty-printed” JSON representation of the TokenLattice
Return type:str