question

CR avatar image
CR asked

Struggling to Parse this with a library

Hi. I am working in C# and am trying to parse the request from Alexa. So far I have:

var jsonResult = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(strAlexaString);

var Slots = jsonResult["request"].intent.slots;

At this point, Slots is

{
                {  "DecisionOne": {  "name": "DecisionOne",  "value": "mountain"  }}}

I can get my slot value (mountain) by doing:

String SlotValue = Slots["DecisionOne"].value;

However, I don't know that the text will be 'DecisionOne'.... I tried Slots[0].value, but that doesn't work.

What is the best way to grab the values of 'name' and 'value'.

Is there a better way if I start using more than one slot (I'm only using one slot at a time now).

Thank you.

alexa skills kitalexa
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Nick Gardner avatar image
Nick Gardner answered

How about Slots["DecisionOne"]["name"].value?

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.