Skip to content

Commit 1dc6403

Browse files
Updated json function description and output datatypes to be more clear (#141)
* added new json functions * added bew url functions * updated the json function description to support array * updated test case for url encode to include path escaping as well * added new url function: escapedPath, fixed names of existing functions * updated: json function descriptions and output data types * updated: json function descriptions
1 parent d787afd commit 1dc6403

File tree

2 files changed

+28
-26
lines changed

2 files changed

+28
-26
lines changed

function/json/README.md

+20-18
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Get value of associated key from json object
2424

2525

2626
## length()
27-
Get the number of elements in json object or array
27+
Get the number of top level elements in json object or array
2828

2929
### Input Args
3030

@@ -34,9 +34,10 @@ Get the number of elements in json object or array
3434

3535
### Output
3636

37-
| Arg | Type | Description |
38-
|:----------|:-------|:------------------------------------|
39-
| returnVal | int | The length items in the json object |
37+
| Arg | Type | Description |
38+
|:--------------|:-------|:---------------------------------------|
39+
| lengthInteger | int | The top level items in the json object |
40+
4041

4142
## numbersToString()
4243
Convert every number type to string in a json object or array
@@ -49,12 +50,13 @@ Convert every number type to string in a json object or array
4950

5051
### Output
5152

52-
| Arg | Type | Description |
53-
|:----------|:-------|:---------------------------------------------------------|
54-
| returnVal | any | The json object or array with numbers encoded as strings |
53+
| Arg | Type | Description |
54+
|:------------------|:-------|:---------------------------------------------------------|
55+
| jsonObjectOrArray | any | The json object or array with numbers encoded as strings |
56+
5557

5658
## objKeys()
57-
Get the list of top level keys of json object
59+
Get the list of all top level keys of json object
5860

5961
### Input Args
6062

@@ -64,13 +66,13 @@ Get the list of top level keys of json object
6466

6567
### Output
6668

67-
| Arg | Type | Description |
68-
|:----------|:-------|:---------------------------|
69-
| returnVal | array | The list of top level keys |
69+
| Arg | Type | Description |
70+
|:---------------|:-------|:---------------------------|
71+
| arrayOfStrings | array | The list of top level keys |
7072

7173

7274
## objValues()
73-
Get list of all the values of a json object
75+
Get the list of all top level values of json object
7476

7577
### Input Args
7678

@@ -80,9 +82,9 @@ Get list of all the values of a json object
8082

8183
### Output
8284

83-
| Arg | Type | Description |
84-
|:----------|:-------|:---------------------------------------|
85-
| returnVal | array | The list all the values in json object |
85+
| Arg | Type | Description |
86+
|:--------------|:-------|:------------------------------------------------|
87+
| arrayOfValues | array | The list of all top level values in json object |
8688

8789

8890
## path()
@@ -115,6 +117,6 @@ Set the value of existing key or add new key and set it's value in a json object
115117

116118
### Output
117119

118-
| Arg | Type | Description |
119-
|:----------|:-------|:------------------------|
120-
| returnVal | any | The updated json object |
120+
| Arg | Type | Description |
121+
|:-----------|:-------|:------------------------|
122+
| jsonObject | any | The updated json object |

function/json/descriptor.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
},
2727
{
2828
"name": "length",
29-
"description": "Get the number of elements in json object or array",
30-
"example": "json.length(jsonObjectOrArray) => value",
29+
"description": "Get the number of top level elements in json object or array",
30+
"example": "json.length(jsonObjectOrArray) => lengthInteger",
3131
"args": [
3232
{
3333
"name": "jsonObjectOrArray",
@@ -41,7 +41,7 @@
4141
{
4242
"name": "numbersToString",
4343
"description": "Convert every number type to string in a json object or array",
44-
"example": "json.numbersToString(jsonObjectOrArray) => value",
44+
"example": "json.numbersToString(jsonObjectOrArray) => jsonObjectOrArray",
4545
"args": [
4646
{
4747
"name": "jsonObjectOrArray",
@@ -54,8 +54,8 @@
5454
},
5555
{
5656
"name": "objKeys",
57-
"description": "Get the list of top level keys of json object",
58-
"example": "json.objKeys(jsonObject) => value",
57+
"description": "Get the list of all top level keys of json object",
58+
"example": "json.objKeys(jsonObject) => arrayOfStrings",
5959
"args": [
6060
{
6161
"name": "jsonObject",
@@ -69,8 +69,8 @@
6969
},
7070
{
7171
"name": "objValues",
72-
"description": "Get list of all the values of a json object",
73-
"example": "json.objValues(jsonObject) => value",
72+
"description": "Get the list of all top level values of json object",
73+
"example": "json.objValues(jsonObject) => arrayOfValues",
7474
"args": [
7575
{
7676
"name": "jsonObject",
@@ -103,7 +103,7 @@
103103
{
104104
"name": "set",
105105
"description": "Set the value of existing key or add new key and set it's value in a json object",
106-
"example": "json.set(jsonObject, \"key\", value) => value",
106+
"example": "json.set(jsonObject, \"key\", value) => jsonObject",
107107
"args": [
108108
{
109109
"name": "jsonObject",

0 commit comments

Comments
 (0)