# QData

![](/files/d6HTZYgPzntCrGrkoWB7)

Rules  :&#x20;

1. **Key name** should be UNIQUE, If the same key name was inserted multiple times. It would be overridden.&#x20;

**Example :** \
QData employeeInfo = extractGroup("firstEmployee");

**Sample :**&#x20;

{

&#x20;"firstName" : "John",

&#x20;"middleName" : "deSouza",&#x20;

"lastName" : "D",

&#x20;"SSN" : "789",&#x20;

"dob" : "08/08/2000",&#x20;

"Eligibility" : true

}

**Ways to get data from QData :**&#x20;

**How to get the value as String ?**

**String empFirstName  =**  employeeInf&#x6F;**.getValueAsString("**&#x66;irstNam&#x65;**");**

**How to get the value as Integer?**

Integer empSSN  =  employeeInf&#x6F;**.getValueAsInteger("**&#x53;S&#x4E;**");**

**How to get the value as Boolean?**

Boolean empEligibility  =  employeeInf&#x6F;**.**&#x67;etValueAsBoolea&#x6E;**("**&#x45;ligibilit&#x79;**");**

**List of QData Commands :**&#x20;

<table><thead><tr><th width="150">Method Name</th><th width="150">Arguments</th><th width="150">Return Type</th><th>Description</th></tr></thead><tbody><tr><td>getValue</td><td>Key Name</td><td>Object</td><td>When the user wants the value to be returned in OBJECT (Data Type) and convert to the required Data type like Qarray,QStringArray etc.<br>This can be used</td></tr><tr><td>isEmpty</td><td>NO ARGS</td><td>Boolean</td><td>This checks whether the initialized Qdata is empty / not</td></tr><tr><td>size</td><td>NO ARGS</td><td>Integer</td><td>This returns the count of the keys in initialized Qdata</td></tr><tr><td>getKey</td><td>NO ARGS</td><td></td><td></td></tr><tr><td>toMap</td><td>NO ARGS</td><td>Map&#x3C;String,Object></td><td>This converts the Qdata object to JAVA Map class </td></tr><tr><td>containsValue</td><td>Value</td><td>Boolean</td><td>This checks the whole Qdata for the given value, return true if the value matches to any of the key</td></tr><tr><td>setValue</td><td>key and value</td><td>VOID</td><td>This inserts the given key and value to the Qdata</td></tr><tr><td>getValueAsString</td><td>Key Name</td><td>String</td><td>This provides the values in the String</td></tr><tr><td>getValueAsQData</td><td>Key Name</td><td>Qdata</td><td>This returns the sub object data in Qdata format, by the key name provided</td></tr><tr><td>getValueAsQStringArray</td><td>Key Name</td><td>QStringArray</td><td><p>Returns Key Value as QStringArray </p><p>if the key value is a String, or multiple values separated with comma it will be converted to QStringArray. </p></td></tr><tr><td>getValueAsQIntegerArray</td><td>Key Name</td><td>QIntegerArray</td><td><p>Returns Key Value as QIntegerArray</p><p>if the key value is a String, or multiple values separated with comma it will be converted to QIntegerArray. </p></td></tr><tr><td>toJsonArray</td><td>key and value</td><td>String</td><td>This converts the Qdata into complete JSON object and the results would be as below sample.<br>givenKeyName : givenValueName : [all the Qdata converted to JSON]</td></tr><tr><td>getKeyNames</td><td>NO ARGS</td><td>QStringArray</td><td>This lists out all the key names.</td></tr><tr><td>doAssert</td><td></td><td></td><td></td></tr><tr><td>bindToContext</td><td>tfStepContext</td><td>Context Values will be set</td><td>This save each and every pair to context and the user can utilize them</td></tr><tr><td>bindToTestRun</td><td>tfStepContext</td><td>Run Values will be set</td><td>This save each and every pair to RUN VALUES and the user can utilize them</td></tr><tr><td>toJson</td><td>NO ARGS</td><td>String</td><td>This converts the compelete Qdata into JSON, this will be utilized in API</td></tr><tr><td>dump</td><td>NO ARGS</td><td>String</td><td>This converts the complete Qdata into string<br>Note : This can be utilized to print the whole Qdata for validating in development activities</td></tr><tr><td>hasDataFor</td><td></td><td></td><td></td></tr><tr><td>getValueAsDouble</td><td>Key Name</td><td>Double</td><td>This provides the values in the Double</td></tr><tr><td>_getValue</td><td></td><td></td><td></td></tr><tr><td>getValueAsBoolean</td><td>Key Name</td><td>Boolean</td><td>This provides the values in the Boolean</td></tr><tr><td>getValueAsInteger</td><td>Key Name</td><td>Integer</td><td>This provides the values in the Integer</td></tr><tr><td>invokeDataModifiers</td><td></td><td></td><td></td></tr></tbody></table>

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.qatts.com/advanced-data-types/qdata.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
