Class: Json

Json()

JSON specific functions

Constructor

new Json()

Source:

Members

dataTypes

Allowed data types

Source:

replace

Replace a JPath to a specified value. The function context is of JSON and cannot be used in CJSON context.

In order to use this in CJSON context, follow below steps:

  1. Create CJson object
  2. Deserialize
  3. Deserialize
  4. cjson.json?.replace("$.jpath", value, object)
Source:

Methods

getAllKeys()

Reads all possible keys.

Source:
Returns:

Keys string[]

getAllValues()

Fetches all values with given JSON keys

Source:
Returns:

Values in string[]

getKeys(jsonData, prevKey)

Reads keys in recursive manner

Parameters:
Name Type Description
jsonData

JSON data

prevKey

Previous key

Source:

getValueFromKey(key)

Parses value from JSON

Parameters:
Name Type Description
key
Source:
Returns:

Value fetched from key

parse(key)

Parses value from JSON

Parameters:
Name Type Description
key
Source:
Returns:

Value fetched from key

pushKey(eachKey, prevKey)

Pushes valid JSON path keys

Parameters:
Name Type Description
eachKey

Key to be appended

prevKey

Previous key

Source:

removeWithKey(key, content)

Removes a key:value from the JSON context. Key will be JPath in $.full.path format

The function automatically deserializes before removing. So, no need to explicitely deserialize it.

Parameters:
Name Type Description
key

JPath to the key

content

JSON string content from which to be removed.

Source:
Returns:

Resultant content in JSON object