swift - The JSON output does not contain a key: "value" -


i have json parsing issue swift code below. error getting says json output not contain key value.

my code:

 alamofire.request(url, method: .get, headers: headers).responsejson { (response) -> void in       let jsonvalue = response.result.value as! nsdictionary      if let bparray = jsonvalue["value"] as? [nsdictionary]{           results in bparray {...} 

issue: conversion doesnt work: if let bparray = jsonvalue["value"] as? [nsdictionary]

my json structure:

{     d: {         results: [             {                 __metadata: {},                 key: "afbwhulfhtku4j4fhwcmkg==",                 parentkey: "aaaaaaaaaaaaaaaaaaaaaa==",                 rootkey: "afbwhulfhtku4j4fhwcmkg==",                 partner: "mm-carr-01",                 type: "2",                 description: "mm demo carrier created single stop / ma",                 frieghtorder: {}             },         ... 

assuming want access results key try this:-

if let bparray = jsonvalue["results"] as? [string: anyobject]{ //yourcode } 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -