dict_to_jsonT_dict_to_jsonDictToJsonDictToJsondict_to_json (Operator)
Name
dict_to_jsonT_dict_to_jsonDictToJsonDictToJsondict_to_json — Transform a dictionary into a JSON string.
Signature
Description
dict_to_jsondict_to_jsonDictToJsonDictToJsonDictToJsondict_to_json transforms the dictionary passed in
DictHandleDictHandleDictHandleDictHandledictHandledict_handle into a JSON string and returns that string
in JsonStringJsonStringJsonStringJsonStringjsonStringjson_string.
Several optional parameters can be set that control the creation of
the JSON strings.
Those parameters can be set via GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name
and GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value and are described in the documentation of
write_dictwrite_dictWriteDictWriteDictWriteDictwrite_dict:
-
'raise_error_if_content_not_serializable'"raise_error_if_content_not_serializable""raise_error_if_content_not_serializable""raise_error_if_content_not_serializable""raise_error_if_content_not_serializable""raise_error_if_content_not_serializable",
-
'compact_json'"compact_json""compact_json""compact_json""compact_json""compact_json",
-
'use_json_arrays'"use_json_arrays""use_json_arrays""use_json_arrays""use_json_arrays""use_json_arrays".
dict_to_jsondict_to_jsonDictToJsonDictToJsonDictToJsondict_to_json can transform several dictionaries at once.
For this, DictHandleDictHandleDictHandleDictHandledictHandledict_handle must contain a tuple of dictionaries.
The output JsonStringJsonStringJsonStringJsonStringjsonStringjson_string will then contain one string
per input dictionary.
Execution Information
- Multithreading type: independent (runs in parallel even with exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
Parameters
DictHandleDictHandleDictHandleDictHandledictHandledict_handle (input_control) dict(-array) → HDict, HTupleMaybeSequence[HHandle]HTupleHtuple (handle) (IntPtr) (HHandle) (handle)
Dictionary handle.
GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name (input_control) attribute.name(-array) → HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Name of the generic parameter.
Default value: []
List of values: 'compact_json'"compact_json""compact_json""compact_json""compact_json""compact_json", 'raise_error_if_content_not_serializable'"raise_error_if_content_not_serializable""raise_error_if_content_not_serializable""raise_error_if_content_not_serializable""raise_error_if_content_not_serializable""raise_error_if_content_not_serializable", 'use_json_arrays'"use_json_arrays""use_json_arrays""use_json_arrays""use_json_arrays""use_json_arrays"
GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value (input_control) attribute.name(-array) → HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)
Value of the generic parameter.
Default value: []
Suggested values: 'true'"true""true""true""true""true", 'false'"false""false""false""false""false"
JsonStringJsonStringJsonStringJsonStringjsonStringjson_string (output_control) string(-array) → HTupleSequence[str]HTupleHtuple (string) (string) (HString) (char*)
String in JSON format.
Example (HDevelop)
dict_to_json (dict{foo: 'bar', bar: [0:2]}, [], [], JSONString)
Result
If the parameters are valid, the operator dict_to_jsondict_to_jsonDictToJsonDictToJsonDictToJsondict_to_json returns
the value 2 (H_MSG_TRUE). If necessary an exception is raised.
Possible Predecessors
create_dictcreate_dictCreateDictCreateDictCreateDictcreate_dict,
read_dictread_dictReadDictReadDictReadDictread_dict,
json_to_dictjson_to_dictJsonToDictJsonToDictJsonToDictjson_to_dict
Possible Successors
json_to_dictjson_to_dictJsonToDictJsonToDictJsonToDictjson_to_dict
Alternatives
read_dictread_dictReadDictReadDictReadDictread_dict,
create_dictcreate_dictCreateDictCreateDictCreateDictcreate_dict
See also
json_to_dictjson_to_dictJsonToDictJsonToDictJsonToDictjson_to_dict,
read_dictread_dictReadDictReadDictReadDictread_dict,
write_dictwrite_dictWriteDictWriteDictWriteDictwrite_dict,
serialize_handleserialize_handleSerializeHandleSerializeHandleSerializeHandleserialize_handle,
deserialize_handledeserialize_handleDeserializeHandleDeserializeHandleDeserializeHandledeserialize_handle,
copy_dictcopy_dictCopyDictCopyDictCopyDictcopy_dict
Module
Foundation