Convert nested JSON array into separate columns in CSV file

2017-11-20, Completely rewrote function to improve performance and add features as -ArrayBase and support for PSStandardMembers and grouped objects. Flatten-Object Recursively flattens objects containing arrays, hash tables and (custom) objects. All added properties of the supplied objects will be aligned with the rest of the objects. Requires PowerShell version 2 or higher. Cmdlet Function Flatten-Object … Read more

With JSONDecoder in Swift 4, can missing keys use a default value instead of having to be optional properties?

You can implement the init(from decoder: Decoder) method in your type instead of using the default implementation: class MyCodable: Codable { var name: String = “Default Appleseed” required init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) if let name = try container.decodeIfPresent(String.self, forKey: .name) { self.name = name } } } You … Read more

How to fetch JSON file in Angular 2

Here is a part of my code that parse JSON, it may be helpful for you: import { Component, Input } from ‘@angular/core’; import { Injectable } from ‘@angular/core’; import { Http, Response, Headers, RequestOptions } from ‘@angular/http’; import {Observable} from ‘rxjs/Rx’; import ‘rxjs/add/operator/map’; import ‘rxjs/add/operator/catch’; @Injectable() export class AppServices{ constructor(private http: Http) { var … Read more

How to parse JSON in Swift using NSURLSession

Don’t declare an AnyObject type for your decoded object since you want it to be an NSDictionary and you’re performing a conversion to do this. Also it’s better to use zero options for NSJSONSerialization instead of random ones. In my example I’ve also used a custom error type just for demonstration. Note, if you’re using … Read more