public class JSONParser
extends java.lang.Object
Constructor and Description |
---|
JSONParser() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getJsonArrayValue(java.lang.String jsonString,
java.lang.String jsonPath)
Extract value from JSON array using json path expression.
|
static java.lang.String |
getJsonArrayValueWithDelimiter(java.lang.String jsonString,
java.lang.String jsonPath,
java.lang.String jsonOperator,
java.lang.String filterStartString,
java.lang.String filterStopString)
Extract value from JSON array using json path expression.
|
static java.lang.String |
getJsonValue(java.lang.String jsonString,
java.lang.String jsonPath)
Extract value from JSON object using json path expression.
|
static java.lang.String |
getJsonValueWithDelimiter(java.lang.String jsonString,
java.lang.String jsonPath,
java.lang.String jsonOperator,
java.lang.String filterStartString,
java.lang.String filterStopString)
Extract value from JSON object using json path expression.
|
static java.lang.String |
modifyJson(java.lang.String oldJson,
java.lang.String modificationRules)
This function modifies the input JSON string with respect to the given modification rules.
|
static java.lang.String |
modifyJson(java.lang.String oldJson,
java.lang.String modificationRules,
java.lang.String removeAllAttributes)
This function modifies the input JSON string with respect to the given modification rules.
|
static java.lang.String |
modifyJsonArray(java.lang.String jsonArray,
java.lang.String modificationRules)
This function modifies the input JSON Array string with respect to the given modification rules.
|
static java.lang.String |
modifyJsonArray(java.lang.String jsonArray,
java.lang.String modificationRules,
java.lang.String removeAllAttributes)
This function modifies the input JSON Array string with respect to the given modification rules.
|
static java.lang.String |
modifyJsonArrayWithDelimiter(java.lang.String jsonArray,
java.lang.String modificationRules,
java.lang.String removeAllAttributes,
java.lang.String jsonOperator,
java.lang.String filterStartString,
java.lang.String filterStopString)
This function modifies the input JSON Array string with respect to the given modification rules.
|
static java.lang.String |
modifyJsonArrayWithFilter(java.lang.String jsonArray,
java.lang.String filter,
java.lang.String modificationRules)
This function modifies the input JSON Array string with respect to the given modification rules.
|
static java.lang.String |
modifyJsonArrayWithFilter(java.lang.String jsonArray,
java.lang.String filter,
java.lang.String modificationRules,
java.lang.String removeAllAttributes)
This function modifies the input JSON Array string with respect to the given modification rules.
|
static java.lang.String |
modifyJsonWithDelimiter(java.lang.String oldJson,
java.lang.String modificationRules,
java.lang.String removeAllAttributes,
java.lang.String jsonOperator,
java.lang.String filterStartString,
java.lang.String filterStopString)
This function modifies the input JSON string with respect to the given modification rules.
|
public static java.lang.String getJsonValue(java.lang.String jsonString, java.lang.String jsonPath) throws java.lang.Exception
jsonString
- JSON Object.jsonPath
- json path expression.java.lang.Exception
- Improper JSON string or jsonPathpublic static java.lang.String getJsonValueWithDelimiter(java.lang.String jsonString, java.lang.String jsonPath, java.lang.String jsonOperator, java.lang.String filterStartString, java.lang.String filterStopString) throws java.lang.Exception
jsonString
- JSON Object.jsonPath
- json path expression.jsonOperator
- Delimiter used to operate on json object. By default '.' operator is used.filterStartString
- Delimiter denoting starting point of the filter. By default '[' is used.filterStopString
- Delimiter denoting end point of the filter. By default ']' is used.java.lang.Exception
- Improper JSON string or jsonPathpublic static java.lang.String getJsonArrayValue(java.lang.String jsonString, java.lang.String jsonPath) throws java.lang.Exception
jsonString
- JSON Array.jsonPath
- json path expression.java.lang.Exception
- Improper JSON string or jsonPathpublic static java.lang.String getJsonArrayValueWithDelimiter(java.lang.String jsonString, java.lang.String jsonPath, java.lang.String jsonOperator, java.lang.String filterStartString, java.lang.String filterStopString) throws java.lang.Exception
jsonString
- JSON Object.jsonPath
- json path expression.jsonOperator
- Delimiter used to operate on json object. By default '.' operator is used.filterStartString
- Delimiter denoting starting point of the filter. By default '[' is used.filterStopString
- Delimiter denoting end point of the filter. By default ']' is used.java.lang.Exception
- Improper JSON string or jsonPathpublic static java.lang.String modifyJson(java.lang.String oldJson, java.lang.String modificationRules) throws java.lang.Exception
oldJson
- JSON String to be modified.modificationRules
- JSON where we map attributes to their respective JSON Path expression. This can be used to flatten the structured json.java.lang.Exception
- Improper JSON string or jsonPathpublic static java.lang.String modifyJson(java.lang.String oldJson, java.lang.String modificationRules, java.lang.String removeAllAttributes) throws java.lang.Exception
oldJson
- JSON String to be modified from policymodificationRules
- JSON where we map attributes to their respective JSON Path expression. This can be used to flatten the structured json.removeAllAttributes
- Indicates whether all attributes should be included in the JSON or only include attributes mentioned in the modification rules. If true only mentioned attributes are returned, Else all attributes are returned.java.lang.Exception
- Improper JSON string or jsonPathpublic static java.lang.String modifyJsonWithDelimiter(java.lang.String oldJson, java.lang.String modificationRules, java.lang.String removeAllAttributes, java.lang.String jsonOperator, java.lang.String filterStartString, java.lang.String filterStopString) throws java.lang.Exception
oldJson
- JSON String to be modified from policymodificationRules
- JSON where we map attributes to their respective JSON Path expression. This can be used to flatten the structured json.removeAllAttributes
- Indicates whether all attributes should be included in the JSON or only include attributes mentioned in the modification rules. If true only mentioned attributes are returned, Else all attributes are returned.jsonOperator
- Delimiter used to operate on json object. By default '.' operator is used.filterStartString
- Delimiter denoting starting point of the filter. By default '[' is used.filterStopString
- Delimiter denoting end point of the filter. By default ']' is used.java.lang.Exception
- Improper JSON string or jsonPathpublic static java.lang.String modifyJsonArray(java.lang.String jsonArray, java.lang.String modificationRules) throws java.lang.Exception
jsonArray
- JSON Array String to be modified from policymodificationRules
- JSON where we map attributes to their respective JSON Path expression. This can be used to flatten the structured json.java.lang.Exception
- Improper JSON string or jsonPathpublic static java.lang.String modifyJsonArray(java.lang.String jsonArray, java.lang.String modificationRules, java.lang.String removeAllAttributes) throws java.lang.Exception
jsonArray
- JSON Array String to be modified from policymodificationRules
- JSON where we map attributes to their respective JSON Path expression. This can be used to flatten the structured json.removeAllAttributes
- Indicates whether all attributes should be included in the JSON or whether only the attributes mentioned in the modification rules should be included. If true only mentioned attributes are returned, Else all attributes are returned.java.lang.Exception
- Improper JSON string or jsonPathpublic static java.lang.String modifyJsonArrayWithFilter(java.lang.String jsonArray, java.lang.String filter, java.lang.String modificationRules) throws java.lang.Exception
jsonArray
- JSON Array String to be modified from policymodificationRules
- JSON where we map attributes to their respective JSON Path expression. This can be used to flatten the structured json.filter
- Filter json obj in array based on attributes. Example: if filter is "id eq P00001" then modification rules will be applied only to obj with id P00001.java.lang.Exception
- Improper JSON string or jsonPathpublic static java.lang.String modifyJsonArrayWithDelimiter(java.lang.String jsonArray, java.lang.String modificationRules, java.lang.String removeAllAttributes, java.lang.String jsonOperator, java.lang.String filterStartString, java.lang.String filterStopString) throws java.lang.Exception
jsonArray
- JSON Array String to be modified from policymodificationRules
- JSON where we map attributes to their respective JSON Path expression. This can be used to flatten the structured json.removeAllAttributes
- Indicates whether all attributes should be included in the JSON or only include attributes mentioned in the modification rules. If true only mentioned attributes are returned, Else all attributes are returned.jsonOperator
- Delimiter used to operate on json object. By default '.' operator is used.filterStartString
- Delimiter denoting starting point of the filter. By default '[' is used.filterStopString
- Delimiter denoting end point of the filter. By default ']' is used.java.lang.Exception
- Improper JSON string or jsonPathpublic static java.lang.String modifyJsonArrayWithFilter(java.lang.String jsonArray, java.lang.String filter, java.lang.String modificationRules, java.lang.String removeAllAttributes) throws java.lang.Exception
jsonArray
- JSON Array String to be modified from policymodificationRules
- JSON where we map attributes to their respective JSON Path expression. This can be used to flatten the structured json.removeAllAttributes
- Indicates whether all attributes should be included in the JSON or only include attributes mentioned in the modification rules. If true only mentioned attributes are returned, Else all attributes are returned.filter
- Filter json obj in array based on attributes. Example: if filter is "id eq P00001" then modification rules will be applied only to obj with id P00001.java.lang.Exception
- Improper JSON string or jsonPath