While attempting to retrieve JSON data from a URL, I encountered a particular issue.
The problem lies in the fact that each row in the Datarows array contains 5 rows, each row consisting of 47 cells. Out of these 47 cells in each row, I am specifically interested in just two of them:
Cell with Key = "Title"
Cell with Key = "Path"
So, my query is: How can I extract only the 2 cells I am interested in from each row?
The format for a cell is as follows:
Key: string;
value: string;
ValueType: string;
Below is my current implementation:
let queryUrl = "/_api/search/query?querytext='" + encodeURIComponent(searchValue) + "'&rowlimit=5";
let response = await this.props.context.spHttpClient.get(queryUrl, SPHttpClient.configurations.v1.overrideWith(spSearchConfig));
let obj = await response.json();
let Datarows = obj["PrimaryQueryResult"]["RelevantResults"]["Table"]["Rows"];
Ultimately, I aim to achieve a result that appears as follows, where cell X represents the title cell, and cell X+1 indicates the path cell:
Row 0: Cell0, Cell1
Row 1: Cell0, Cell1
Row 2: Cell0, Cell1
Row 3: Cell0, Cell1
Row 4: Cell0, Cell1