Md. Parvez Alam
Md. Parvez Alam

Reputation: 4596

Get items value from Dynamodb search result

I have to following code to query from dynamodb

Search search = table.Query(new QueryOperationConfig { Filter = filter, AttributesToGet = list of attributes});

I can see there is data in search by expanding its node while debugging, but could not find an easy way to get the items key and values directly.

I tried with

              List<Document> documentSet = new List<Document>();
 do
            {
                documentSet = search.GetNextSet();
               foreach (var document in documentSet)
            {
                HttpContext.Current.Response.Write(document["columnName"]);
                HttpContext.Current.Response.Write(document["columnName"]);
            }
            } while (!search.IsDone);

Is there any direct way to get the keys and value from Search object in json or table any in any thing?

Thanks

Upvotes: 0

Views: 1613

Answers (1)

Pavel Safronov
Pavel Safronov

Reputation: 1286

Given an individual Document (in your case, the document object), you can call document.ToJson() or document.ToJsonPretty() to retrieve the JSON representation of the document. This blog post provides more details.

Upvotes: 1

Related Questions