[Solved] how to encode this JSON reply from Food API

You have some response and this response’s value is most likely of type Data, so you need to decode it to some Swift type. Since Swift 4 you can easily use Decodable protocol for decoding Data to your custom model conforming to this protocol. So let’s create simple struct for simple json Json: let data … Read more

[Solved] How to parse JSON extract array [closed]

That depends of the definition of your structs. if you want only the array of items, you should unmarshal the main structure and then get the items array. something like this package main import ( “encoding/json” “fmt” “io/ioutil” “os” ) type Structure struct { Items []Item `json:”items”` } type Item struct { ID int `json:”id”` … Read more

[Solved] How to pass JSON data from ListView to new activity

You can send an object as a parameter to another activity if the object implements Parcelable: A typical implementation of Parcelable here Then, to send like parameter, something like this: Intent intent = new Intent(this, DetailMovieActivity.class); intent.putExtra(“key”, movie);//Your object that implements Parcelable startActivity(intent); And in the other activity: Bundle arguments = new Bundle(); Movie movie … Read more

[Solved] PowerShell parsing JSON

Not that straight forward if you want to group by rows of Value names. I took liberty of thinking the logic for you. Below code will output to csv what you need: $jsonContent = Get-Content .\release.json | ConvertFrom-Json; $environmentsArray = $jsonContent.environments; # Create an array of data we will be putting into Excel $arrData = … Read more

[Solved] Getting MultiDimensional Array from JSONArray(PHP to ANDROID) [closed]

String s = “[{\”index\”:1,\”questions\”:\”If the number of berths in a train are 900 more than one-fifth of it, find the total berths in the train?\”,\”options\”:[\”1145\”,\”1130\”,\”1135\”,\”1125\”,\”1120\”],\”answers\”:\”1125\”,\”useranswers\”:\”1145\”}]”; try { JSONArray a; a = new JSONArray(s); JSONObject o = (JSONObject) a.get(0); JSONArray options = o.getJSONArray(“options”); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } 2 … Read more

[Solved] Deserializing Json string c# [closed]

your json is not valid. But if you remove an extra braket at the start and the end of a string json = json.Substring(1,json.Length-2); then you can parse it using Newtonsoft.Json; var jsonObject = JObject.Parse(json); int density = (int)jsonObject[“density”]; double[] coordinates = jsonObject[“geometry”][“coordinates”].ToObject<double[]>(); 1 solved Deserializing Json string c# [closed]

[Solved] parse json using objective-c [closed]

you need to get the key as per your json. using that keys you will get the data. NSURL * url=[NSURL URLWithString:@”http://api.geonames.org/citiesJSON?north=44.1&south=-9.9&east=-22.4&west=55.2&lang=de&username=demo”]; // pass your URL Here. NSData * data=[NSData dataWithContentsOfURL:url]; NSError * error; NSMutableDictionary * json = [NSJSONSerialization JSONObjectWithData:data options: NSJSONReadingMutableContainers error: &error]; NSLog(@”%@”,json); NSMutableArray * referanceArray=[[NSMutableArray alloc]init]; NSMutableArray * periodArray=[[NSMutableArray alloc]init]; NSArray * … Read more

[Solved] Json value failed in ios [closed]

I fixed this issue by replacing /n with empty string in json string NSString *json = [[NSString alloc]init]; json = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil]; json = [json stringByReplacingOccurrencesOfString:@”\n” withString:@””]; // NSLog(@”json %@”,json); NSArray *issueDetailsAry = [[json JSONValue]objectForKey:@”GetIssues”]; Now i got the output. This issue is because of server side linebreaks. solved Json value failed in … Read more

[Solved] How to parse this queryString which is a resultant of JSON response [closed]

It is NOT possible unless the URL parameter is properly URL-encoded, so the “&” characters will be escaped in order not to be interpreted as field separators. The string should be encoded like this: String queryString = “AQB=1&v1=somev1data&v25=somev25data&URL=http%3A%2F%2Fwww.someurl.com%2Fconfigure%2Fgetvalues%2Frequest1%3Dreq1Passed%26data2%3DsomedataPassed&ce=UTF-8&ARB=1”; As it is formatted in your question, the string cannot be parsed successively. 2 solved How to … Read more

[Solved] NewtonSoft Json Invalid Cast Exception

You need to use the generic overload JsonSerializer.Deserialize<T>() var root = serializer.Deserialize<API_Json_Special_Feeds.RootObject>(jsonTextReader); Unlike files generated by BinaryFormatter, JSON files generally do not include c# type information, so it’s necessary for the receiving system to specify the expected type. (There are extensions to the JSON standard in which c# type information can be included in a … Read more