dict_to_jsonT_dict_to_jsonDictToJsonDictToJsondict_to_json (Operator)

Name

dict_to_jsonT_dict_to_jsonDictToJsonDictToJsondict_to_json — Umwandeln eines Dictionaries in einen JSON-String.

Signatur

dict_to_json( : : DictHandle, GenParamName, GenParamValue : JsonString)

Herror T_dict_to_json(const Htuple DictHandle, const Htuple GenParamName, const Htuple GenParamValue, Htuple* JsonString)

void DictToJson(const HTuple& DictHandle, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* JsonString)

static HTuple HDict::DictToJson(const HDictArray& DictHandle, const HTuple& GenParamName, const HTuple& GenParamValue)

HString HDict::DictToJson(const HString& GenParamName, const HString& GenParamValue) const

HString HDict::DictToJson(const char* GenParamName, const char* GenParamValue) const

HString HDict::DictToJson(const wchar_t* GenParamName, const wchar_t* GenParamValue) const   (Nur Windows)

static void HOperatorSet.DictToJson(HTuple dictHandle, HTuple genParamName, HTuple genParamValue, out HTuple jsonString)

static HTuple HDict.DictToJson(HDict[] dictHandle, HTuple genParamName, HTuple genParamValue)

string HDict.DictToJson(string genParamName, string genParamValue)

def dict_to_json(dict_handle: MaybeSequence[HHandle], gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, float, str]]) -> Sequence[str]

def dict_to_json_s(dict_handle: MaybeSequence[HHandle], gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, float, str]]) -> str

Beschreibung

dict_to_jsondict_to_jsonDictToJsonDictToJsonDictToJsondict_to_json wandelt das in DictHandleDictHandleDictHandleDictHandledictHandledict_handle übergebene Dictionary in einen JSON-String um, welcher in JsonStringJsonStringJsonStringJsonStringjsonStringjson_string zurückgegeben wird.

Eine Reihe weiterer optionaler Parameter kann gesetzt werden, welche die Erzeugung des JSON-Strings beeinflussen. Diese können über die Parameter GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name und GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value gesetzt werden und sind in der Dokumentation von write_dictwrite_dictWriteDictWriteDictWriteDictwrite_dict genauer beschrieben:

dict_to_jsondict_to_jsonDictToJsonDictToJsonDictToJsondict_to_json kann mehrere Dictionaries in JSON-Strings umwandeln. Dafür muss in DictHandleDictHandleDictHandleDictHandledictHandledict_handle ein Tupel von Dictionaries übergeben werden. Die Ausgabe JsonStringJsonStringJsonStringJsonStringjsonStringjson_string enthält in diesem Fall einen String pro Eingabe-Dictionary.

Ausführungsinformationen

Parameter

DictHandleDictHandleDictHandleDictHandledictHandledict_handle (input_control)  dict(-array) HDict, HTupleMaybeSequence[HHandle]HTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle des Dictionaries.

GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name (input_control)  attribute.name(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Name des generischen Parameters.

Defaultwert: []

Werteliste: '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)

Wert des generischen Parameters.

Defaultwert: []

Wertevorschläge: '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 im JSON-Format.

Beispiel (HDevelop)

dict_to_json (dict{foo: 'bar', bar: [0:2]}, [], [], JSONString)

Ergebnis

Sind die Parameterwerte korrekt dann liefert dict_to_jsondict_to_jsonDictToJsonDictToJsonDictToJsondict_to_json den Wert 2 (H_MSG_TRUE). Gegebenenfalls wird eine Fehlerbehandlung durchgeführt.

Vorgänger

create_dictcreate_dictCreateDictCreateDictCreateDictcreate_dict, read_dictread_dictReadDictReadDictReadDictread_dict, json_to_dictjson_to_dictJsonToDictJsonToDictJsonToDictjson_to_dict

Nachfolger

json_to_dictjson_to_dictJsonToDictJsonToDictJsonToDictjson_to_dict

Alternativen

read_dictread_dictReadDictReadDictReadDictread_dict, create_dictcreate_dictCreateDictCreateDictCreateDictcreate_dict

Siehe auch

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

Modul

Foundation