MCPcopy Create free account
hub / github.com/StackStorm/st2 / to_json_string

Function to_json_string

st2common/st2common/expressions/functions/data.py:47–61  ·  view source on GitHub ↗
(value, indent=None, sort_keys=False, separators=(",", ": "))

Source from the content-addressed store, hash-verified

45
46
47def to_json_string(value, indent=None, sort_keys=False, separators=(",", ": ")):
48 value = db_util.mongodb_to_python_types(value)
49
50 options = {}
51
52 if indent is not None:
53 options["indent"] = indent
54
55 if sort_keys is not None:
56 options["sort_keys"] = sort_keys
57
58 if separators is not None:
59 options["separators"] = separators
60
61 return json.dumps(value, **options)
62
63
64def to_yaml_string(value, indent=None, allow_unicode=True):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected