json.numbersToString

This function converts every number type to string in a JSON object or array.

Syntax

json.numbersToString(jsonObjectOrArray)

Arguments

Argument

Type

Description

jsonObjectorArray

any

The JSON object or array.

Returns

Type

Description

any

The JSON object or array with numbers encoded as strings.

Examples

Let us say the jsonObject includes the following:

jsonObject = {
"id": 1,
"name": "bob"
}

The json.numbersToString(jsonObject) returns the following:

{
"id": "1",
"name": "bob"
}

The number 1 is returned as a string.