[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-26 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eTO_JSON\u003c/code\u003e function converts a value into a JSON object within Application Integration.\u003c/p\u003e\n"],["\u003cp\u003eIt supports various data types, including Boolean, Double, Integer, and String, in both single and array formats.\u003c/p\u003e\n"],["\u003cp\u003eUsing \u003ccode\u003eTO_JSON()\u003c/code\u003e on a string variable will convert the string into a JSON object, such as converting \u003ccode\u003e"{product: "cake", id: 21, price: 5}"\u003c/code\u003e to \u003ccode\u003e{product: "cake", id: 21, price: 5}\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIf using a JSON schema containing both integer and number elements in an array, utilizing version 7 or greater of the schema is recommended to avoid potential runtime errors.\u003c/p\u003e\n"]]],[],null,["# TO_JSON function\n\nSee the [supported connectors](/integration-connectors/docs/connector-reference-overview) for Application Integration.\n\nTO_JSON function\n================\n\n`TO_JSON` function\n------------------\n\nSupported data type\n===================\n\n\nThe `TO_JSON` function supports the following data types:\n\n- Boolean\n- Boolean array\n- Double\n- Double array\n- Integer\n- Integer array\n- String\n- String array\n\nExample: Convert a string to a JSON\n-----------------------------------\n\n\n**Sample data** : `$var1$ = \"{product: \"cake\", id: 21, price: 5}\"`\n\n\n**Usage** : `$var1$.TO_JSON()`\nConvert var1 to JSON.\n\n\n**Output** : `{product: \"cake\", id: 21, price: 5}`\n| **Note:** If your JSON schema has an array with both **integer** and **number** elements, using JSON schema version 4 might lead to unexpected errors at runtime. To prevent the error, set the schema to version 7 or greater. For example, `\"$schema\": \"http://json-schema.org/draft-07/schema#\"`.\n\nRecommendation\n--------------\n\n- Learn how to add and configure a [Data Mapping task](/application-integration/docs/configure-data-mapping-task)"]]