Skip to content

Commit

Permalink
Merge pull request #9090 from surveyjs/serialization-api
Browse files Browse the repository at this point in the history
Update the `settings.serialization` API description
  • Loading branch information
andrewtelnov authored Nov 22, 2024
2 parents da31fe8 + 8ffcf4b commit 165a6d2
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions packages/survey-core/src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,27 +187,16 @@ export var settings = {
* Nested properties:
*
* - `itemValueSerializeAsObject`: `boolean`\
* Enable this property if you want to serialize [`ItemValue`](https://surveyjs.io/form-library/documentation/api-reference/itemvalue) instances as objects even when they include only the `value` property. Default value: `false`. View an example below.
* Enable this property if you want to serialize [`ItemValue`](https://surveyjs.io/form-library/documentation/api-reference/itemvalue) instances (choice options, matrix rows, columns in a [Single-Select Matrix](https://surveyjs.io/form-library/documentation/api-reference/matrix-table-question-model)) as objects even when they include only the `value` property. Default value: `false`.
*
* - `itemValueSerializeDisplayText`: `boolean`\
* Enable this property if you want to serialize the `text` property of [`ItemValue`](https://surveyjs.io/form-library/documentation/api-reference/itemvalue) objects even when it is empty or equal to the `value` property. Default value: `false`. View an example below.
* Enable this property if you want to serialize the `text` property of [`ItemValue`](https://surveyjs.io/form-library/documentation/api-reference/itemvalue) objects even when it is empty or equal to the `value` property. Default value: `false`.
*
* - `localizableStringSerializeAsObject`: `boolean`\
* Enable this property if you want to serialize [`LocalizableString`](https://surveyjs.io/form-library/documentation/api-reference/localizablestring) instances as objects even when they include only a translation string for the default locale. For example, `"Custom String"` will be serialized as `{ default: "Custom String" }`. Default value: `false`.
*
* ```js
* import { ItemValue, settings } from "survey-core";
*
* // `itemValueSerializeAsObject` example
* settings.serialization.itemValueSerializeAsObject = true;
* const item = new ItemValue(5);
* const itemString = item.toJSON(); // Produces { value: 5 } instead of 5
*
* // `itemValueSerializeDisplayText` example
* settings.serialization.itemValueSerializeDisplayText = true;
* const item = new ItemValue("item1");
* const itemString = item.toJSON(); // Produces { value: "item1", text: "item1" } instead of "item1"
* ```
* - `matrixDropdownColumnSerializeTitle`: `boolean`\
* Enable this property if you want to serialize the `title` property of [`MatrixDropdownColumn`](https://surveyjs.io/form-library/documentation/api-reference/multi-select-matrix-column-values) objects even when it is empty or equal to the `name` property. Default value: `false`.
* @see [settings.parseNumber](https://surveyjs.io/form-library/documentation/api-reference/settings#parseNumber)
*/
serialization: {
Expand Down

0 comments on commit 165a6d2

Please sign in to comment.