You need to deserialize the json to an object. I strongly recommend using the excellent library
json.net which is what everybody uses. You can get it via nuget package management, or from the website.
Once you have the json response as a string, you should deserialize it to an instance of a class you've defined, which matches the format of the response. For example:
Code:
public class FooResponse
{
public object pagination { get; set; }
public List<Payment> data { get; set; }
}
public class Payment
{
public int Value { get; set; }
}
(I pretended your Payment class has a value field)
Then getting at your payments becomes:
Code:
string jsonResponse = GetResponseSomehow();
FooResponse responseObject = JsonConvert.DeserializeObject<FooResponse>(responseString);
List<Payment> payments = responseObject.data;
In this code, there's only one Payment class, which matches both the format of the data array in the json and also whatever you need it for in the rest of your code. In practice, I recommend having a different class for each purpose. One to match the json, and one to serve your own needs. You can define a map function to go between them.
By the way, in C# map is called Select, and it's available on basically any collection. It takes a lambda just like in ruby. filter is called Where.