Dynamic Filtering of JSON Data Based on Variable Status Conditions

Hi

I need to fetch a list of conversationId based on status.
Below linq works

ArrStatusToBeKept=in_TransactionItem.SpecificContent(“Kustomer Queue Status”).ToString.ToLower.Split(";"c)

DeserializeConvIDJson(“data”) _
.Where(Function(x) x(“attributes”)(“status”).ToString() = ArrStatusToBeKept(0).ToString Or x(“attributes”)(“status”).ToString() = ArrStatusToBeKept(1).ToString()) _
.Select(Function(x) x(“relationships”)(“resource”)(“data”)(“id”).Value(Of String)) _
.ToArray()

I get error if there are less or more items in ArrStatusToBeKept (it works only when there are 2 items in array ).How to solve this issue

A few details are not clear. With some samples it would be more clear for us.

Assumption: filtering on Any present ArrStatusToBeKept

Give a try at

DeserializeConvIDJson("data") _
.Where(Function(x) ArrStatusToBeKept.Contains(x("attributes")("status").ToString().ToLower()) _
.Select(Function(x) x("relationships")("resource")("data")("id").Value(Of String)) _
.ToArray()

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.