How to get specific element in JSON
If I have J开发者_如何学PythonSON that is:
var response = {results: 2938; id: 9283};
How can I get id using javascript/jquery?
I tried something like but I can't seem to get what I want (I want to get the number in id):
response[1]
and
response[1].id
Simple:
response.id
With that being said, your json is invalid,
var response = {results: 2938; id: 9283};
Use a ,
to separate items not a ;
var response = {results: 2938, id: 9283};
And since I love jsfiddle so much, here is an example.
Just response.id
. You don't need anything more.
You should just need to use:
response.id
dynamic func_param = JsonConvert.DeserializeObject(key);
foreach (var invoicekey in func_param)
{
var invoice = merchelloHelper.Query.Invoice.GetByKey(Guid.Parse(invoicekey.Value));
}
精彩评论