Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
let steveDocument = """
{ "key" : 2, "company": "Apple" }
"""
.data(using: .utf8)!
let billDocument = """
{ "key" : 1, "company": "Microsoft" }
"""
.data(using: .utf8)!
public struct Plain: Codable
{
public var key: Int
public var company: String
}
var dataFrame = DataFrame()
let columnName = Column(ColumnID("Name", String.self), contents: [ "Steve", "Bill" ])
let columnJSON = Column(ColumnID("Document", Data.self), contents: [ steveDocument, billDocument ])
dataFrame.append(column: columnName)
dataFrame.append(column: columnJSON)
print(dataFrame)
try dataFrame.decode(Plain.self, inColumn: "Document", using: JSONDecoder())
print(dataFrame)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment