JSONify

Convertit une valeur en sa représentation au format JSON

Syntaxe

function JSONify(value: Variant): String
value: valeur (variant) à convertir en JSON

Remarques

Applique les règles de transformation des valeurs (String, Integer, Float et Boolean) au format JSON.

A partir de Qubes 7.1, cette fonction est historique, préférer JSON.Stringify, qui supporte aussi les types structurés.

Pour convertir une TStrings en JSON, utiliser la méthode AsJSONArray.

Pour convertir une Datagrid en JSON, utiliser la méthode AsJSON.

Exemples

PrintLn(JSONify('')); // renvoie '""'
PrintLn(JSONify('test')); // renvoie '"test"'
PrintLn(JSONify('Voici le "test"'#13#10'12 / 3 = 4'#$20B1)); // renvoie '"Voici le \"test\"\r\n12 \/ 3 = 4₱"'
PrintLn(JSONify('123')); // renvoie '"123"'
PrintLn(JSONify(123)); // renvoie '123'
PrintLn(JSONify(123.45)); // renvoie '123.45'
PrintLn(JSONify(True)); // renvoie 'true'
PrintLn(JSONify(False)); // renvoie 'false'
PrintLn(JSONify(null)); // renvoie 'null'

Classification

SysUtils