Skip to content

Commit

Permalink
Updated json function description and output datatypes to be more cle…
Browse files Browse the repository at this point in the history
…ar (#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
  • Loading branch information
awakchau-tibco authored Jul 19, 2021
1 parent d787afd commit 1dc6403
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 26 deletions.
38 changes: 20 additions & 18 deletions function/json/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Get value of associated key from json object


## length()
Get the number of elements in json object or array
Get the number of top level elements in json object or array

### Input Args

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

### Output

| Arg | Type | Description |
|:----------|:-------|:------------------------------------|
| returnVal | int | The length items in the json object |
| Arg | Type | Description |
|:--------------|:-------|:---------------------------------------|
| lengthInteger | int | The top level items in the json object |


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

### Output

| Arg | Type | Description |
|:----------|:-------|:---------------------------------------------------------|
| returnVal | any | The json object or array with numbers encoded as strings |
| Arg | Type | Description |
|:------------------|:-------|:---------------------------------------------------------|
| jsonObjectOrArray | any | The json object or array with numbers encoded as strings |


## objKeys()
Get the list of top level keys of json object
Get the list of all top level keys of json object

### Input Args

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

### Output

| Arg | Type | Description |
|:----------|:-------|:---------------------------|
| returnVal | array | The list of top level keys |
| Arg | Type | Description |
|:---------------|:-------|:---------------------------|
| arrayOfStrings | array | The list of top level keys |


## objValues()
Get list of all the values of a json object
Get the list of all top level values of json object

### Input Args

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

### Output

| Arg | Type | Description |
|:----------|:-------|:---------------------------------------|
| returnVal | array | The list all the values in json object |
| Arg | Type | Description |
|:--------------|:-------|:------------------------------------------------|
| arrayOfValues | array | The list of all top level values in json object |


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

### Output

| Arg | Type | Description |
|:----------|:-------|:------------------------|
| returnVal | any | The updated json object |
| Arg | Type | Description |
|:-----------|:-------|:------------------------|
| jsonObject | any | The updated json object |
16 changes: 8 additions & 8 deletions function/json/descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
},
{
"name": "length",
"description": "Get the number of elements in json object or array",
"example": "json.length(jsonObjectOrArray) => value",
"description": "Get the number of top level elements in json object or array",
"example": "json.length(jsonObjectOrArray) => lengthInteger",
"args": [
{
"name": "jsonObjectOrArray",
Expand All @@ -41,7 +41,7 @@
{
"name": "numbersToString",
"description": "Convert every number type to string in a json object or array",
"example": "json.numbersToString(jsonObjectOrArray) => value",
"example": "json.numbersToString(jsonObjectOrArray) => jsonObjectOrArray",
"args": [
{
"name": "jsonObjectOrArray",
Expand All @@ -54,8 +54,8 @@
},
{
"name": "objKeys",
"description": "Get the list of top level keys of json object",
"example": "json.objKeys(jsonObject) => value",
"description": "Get the list of all top level keys of json object",
"example": "json.objKeys(jsonObject) => arrayOfStrings",
"args": [
{
"name": "jsonObject",
Expand All @@ -69,8 +69,8 @@
},
{
"name": "objValues",
"description": "Get list of all the values of a json object",
"example": "json.objValues(jsonObject) => value",
"description": "Get the list of all top level values of json object",
"example": "json.objValues(jsonObject) => arrayOfValues",
"args": [
{
"name": "jsonObject",
Expand Down Expand Up @@ -103,7 +103,7 @@
{
"name": "set",
"description": "Set the value of existing key or add new key and set it's value in a json object",
"example": "json.set(jsonObject, \"key\", value) => value",
"example": "json.set(jsonObject, \"key\", value) => jsonObject",
"args": [
{
"name": "jsonObject",
Expand Down

0 comments on commit 1dc6403

Please sign in to comment.