Package com.privalia.qa.utils
Class JsonUtils
- java.lang.Object
-
- com.privalia.qa.utils.JsonUtils
-
public class JsonUtils extends Object
Generic utilities for operations with Json and text formats.
-
-
Constructor Summary
Constructors Constructor Description JsonUtils()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
modifyDataJson(String data, String type, io.cucumber.datatable.DataTable modifications)
Returns the information modifiedString
modifyDataString(String data, String type, io.cucumber.datatable.DataTable modifications)
Returns the information modifiedorg.hjson.JsonObject
removeNulls(org.hjson.JsonObject object)
Eliminates null occurrences, replacing them with "TO_BE_NULL"
-
-
-
Method Detail
-
modifyDataJson
public String modifyDataJson(String data, String type, io.cucumber.datatable.DataTable modifications) throws Exception
Returns the information modified- Parameters:
data
- string containing the informationtype
- type of information, it can be: jsonmodifications
- modifications to apply with a format: WHERE,ACTION,VALUE- Returns:
- resulting string
- Throws:
Exception
- the exception
-
modifyDataString
public String modifyDataString(String data, String type, io.cucumber.datatable.DataTable modifications) throws Exception
Returns the information modified- Parameters:
data
- string containing the informationtype
- type of information, it can be: stringmodifications
- modifications to apply with a format: WHERE,ACTION,VALUE- Returns:
- resulting string
- Throws:
Exception
- the exception
-
removeNulls
public org.hjson.JsonObject removeNulls(org.hjson.JsonObject object)
Eliminates null occurrences, replacing them with "TO_BE_NULL"- Parameters:
object
- JsonObject containing json where to replace null ocurrences- Returns:
- JsonObject
-
-