I have a JWT that I want to display its contents after signature validation. so, I verify the signature like this:
var verified = JWT.Decode(token, publicKey);
In this case, verified
is a string
containing the JSON payload, looks something like this:
{"sub":"211668914321303","aud":"MUSCA","ver":"1.0.0","nbf":1544459925,"iss":"blimp gmbh","rle":"MUSCA_ACCESS","prm":"This chunk is bound to the something for blimp gmbh","exp":4703150773,"iat":1544459925,"jti":"46"}
now to view this on a page in form of a table, it's easier to send it as a JSON, and loop on its Type and Value, like this:
var verifiedJSON = JsonConvert.DeserializeObject(verified); //convert to JSON ViewBag.payload = verifiedJSON
in my view, I loop on the ViewBag like this
<table class="table-bordered table-responsive"> @foreach (var line in ViewBag.payload) { <tr> <td>@line.Type</td> <td>@line.Value</td> </tr> }
I would expect that the table will show type and value in columns, but instead of the type(key), I get the word Property, with the expected value in each row!
I tried to display the JSON below the table to see if it came with "property" in the key fields, but it viewed with the correct key names. am I missing something or why can't I get the table to view the keys correctly?
line.Type
(which of course will return Property... as it's basically the Type of the Key (in the key:value pair)). I'm not sure what's the correct one off the top of my head but it should be something likeline.Key
(As in the name of the key)